diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-07-05 09:06:55 -0400 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2017-07-05 09:06:55 -0400 |
commit | 4219d39e97bfe646e28696f9871fc8c1b8310154 (patch) | |
tree | 1feda604ab49c28fc1786edb406c329331d69766 /app/channel.go | |
parent | 0e1a9b7ebfd879359d9dfdcdf46b1919007b7b91 (diff) | |
download | chat-4219d39e97bfe646e28696f9871fc8c1b8310154.tar.gz chat-4219d39e97bfe646e28696f9871fc8c1b8310154.tar.bz2 chat-4219d39e97bfe646e28696f9871fc8c1b8310154.zip |
Return channel member immediately if user is already in channel (#6847)
Diffstat (limited to 'app/channel.go')
-rw-r--r-- | app/channel.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/channel.go b/app/channel.go index 2a710a3c0..9f8d20419 100644 --- a/app/channel.go +++ b/app/channel.go @@ -543,6 +543,14 @@ func AddUserToChannel(user *model.User, channel *model.Channel) (*model.ChannelM } func AddChannelMember(userId string, channel *model.Channel, userRequestorId string) (*model.ChannelMember, *model.AppError) { + if result := <-Srv.Store.Channel().GetMember(channel.Id, userId); result.Err != nil { + if result.Err.Id != store.MISSING_CHANNEL_MEMBER_ERROR { + return nil, result.Err + } + } else { + return result.Data.(*model.ChannelMember), nil + } + var user *model.User var err *model.AppError |