PLT-2559 Always return successful when trying to join a channel that the user is already a member of (#3265)

* Added unit tests for SqlChannelStore.GetMember

* Fixed api routes for accessing channels by name when the name includes an underscore

* Changed join channel API to always return successful when the user is already a member of the channel
Этот коммит содержится в:
Harrison Healey
2016-06-06 13:03:56 -04:00
родитель 2c42294bbc
Коммит 384d0eb245
4 изменённых файлов: 97 добавлений и 4 удалений

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

@@ -476,6 +476,11 @@ func joinChannel(c *Context, channelChannel store.StoreChannel, userChannel stor
channel := cresult.Data.(*model.Channel)
user := uresult.Data.(*model.User)
if mresult := <-Srv.Store.Channel().GetMember(channel.Id, user.Id); mresult.Err == nil && mresult.Data != nil {
// the user is already in the channel so just return successful
return nil, channel
}
if !c.HasPermissionsToTeam(channel.TeamId, "join") {
return c.Err, nil
}