1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-12-24 13:43:12 +02:00

Fix a bug where board didn;t show up in LHS when someone added me on it (#4133)

This commit is contained in:
Harshil Sharma 2022-11-08 21:30:14 +05:30 committed by GitHub
parent bddeeedd75
commit d39abc305d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 0 deletions

View File

@ -519,6 +519,10 @@ func (a *App) AddMemberToBoard(member *model.BoardMember) (*model.BoardMember, e
return nil, err
}
if err = a.addBoardsToDefaultCategory(member.UserID, board.TeamID, []*model.Board{board}); err != nil {
return nil, err
}
a.blockChangeNotifier.Enqueue(func() error {
a.wsAdapter.BroadcastMemberChange(board.TeamID, member.BoardID, member)
return nil

View File

@ -27,6 +27,7 @@ func TestAddMemberToBoard(t *testing.T) {
}
th.Store.EXPECT().GetBoard(boardID).Return(&model.Board{
ID: "board_id_1",
TeamID: "team_id_1",
}, nil)
@ -42,6 +43,17 @@ func TestAddMemberToBoard(t *testing.T) {
// for WS change broadcast
th.Store.EXPECT().GetMembersForBoard(boardID).Return([]*model.BoardMember{}, nil)
th.Store.EXPECT().GetUserCategoryBoards("user_id_1", "team_id_1").Return([]model.CategoryBoards{
{
Category: model.Category{
ID: "default_category_id",
Name: "Boards",
Type: "system",
},
},
}, nil)
th.Store.EXPECT().AddUpdateCategoryBoard("user_id_1", "default_category_id", "board_id_1").Return(nil)
addedBoardMember, err := th.App.AddMemberToBoard(boardMember)
require.NoError(t, err)
require.Equal(t, boardID, addedBoardMember.BoardID)
@ -83,6 +95,7 @@ func TestAddMemberToBoard(t *testing.T) {
}
th.Store.EXPECT().GetBoard(boardID).Return(&model.Board{
ID: "board_id_1",
TeamID: "team_id_1",
}, nil)
@ -104,6 +117,17 @@ func TestAddMemberToBoard(t *testing.T) {
// for WS change broadcast
th.Store.EXPECT().GetMembersForBoard(boardID).Return([]*model.BoardMember{}, nil)
th.Store.EXPECT().GetUserCategoryBoards("user_id_1", "team_id_1").Return([]model.CategoryBoards{
{
Category: model.Category{
ID: "default_category_id",
Name: "Boards",
Type: "system",
},
},
}, nil)
th.Store.EXPECT().AddUpdateCategoryBoard("user_id_1", "default_category_id", "board_id_1").Return(nil)
addedBoardMember, err := th.App.AddMemberToBoard(boardMember)
require.NoError(t, err)
require.Equal(t, boardID, addedBoardMember.BoardID)