1
0
mirror of https://github.com/mattermost/focalboard.git synced 2025-01-23 18:34:02 +02:00

Handled err in acse of lack of user-channel membership (#3378)

* Handled err in acse of lack of user-channel membership

* Used errors.As instead of type check

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
Harshil Sharma 2022-07-27 23:47:38 +05:30 committed by GitHub
parent 95b65dba22
commit 36a073eaad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -669,8 +669,16 @@ func (s *MattermostAuthLayer) GetMemberForBoard(boardID, userID string) (*model.
if b.ChannelID != "" {
_, err := s.servicesAPI.GetChannelMember(b.ChannelID, userID)
if err != nil {
var appErr *mmModel.AppError
if errors.As(err, &appErr) && appErr.StatusCode == http.StatusNotFound {
// Plugin API returns error if channel member doesn't exist.
// We're fine if it doesn't exist, so its not an error for us.
return nil, nil
}
return nil, err
}
return &model.BoardMember{
BoardID: boardID,
UserID: userID,