Fix a bug where board didn;t show up in LHS when someone added me on it (#4133)
This commit is contained in:
parent
bddeeedd75
commit
d39abc305d
2 changed files with 28 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue