[MM-21793] Allow bots to be added to group synced channels and teams (#13672)

* MM-21793: Allow bots to be removed and added from group synced teams and channels

* MM-21793: Add tests for adding and removing a team and channel members

* MM-21793 Add punctuation to comments and remove unnecessary variable
Этот коммит содержится в:
Farhan Munshi
2020-01-29 11:01:06 -05:00
коммит произвёл GitHub
родитель ffb3897c8c
Коммит fa769e46d7
10 изменённых файлов: 191 добавлений и 45 удалений

Просмотреть файл

@@ -1398,12 +1398,18 @@ func removeChannelMember(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
user, err := c.App.GetUser(c.Params.UserId)
if err != nil {
c.Err = err
return
}
if !(channel.Type == model.CHANNEL_OPEN || channel.Type == model.CHANNEL_PRIVATE) {
c.Err = model.NewAppError("removeChannelMember", "api.channel.remove_channel_member.type.app_error", nil, "", http.StatusBadRequest)
return
}
if channel.IsGroupConstrained() && (c.Params.UserId != c.App.Session.UserId) {
if channel.IsGroupConstrained() && (c.Params.UserId != c.App.Session.UserId) && !user.IsBot {
c.Err = model.NewAppError("removeChannelMember", "api.channel.remove_member.group_constrained.app_error", nil, "", http.StatusBadRequest)
return
}