summaryrefslogtreecommitdiffstats
path: root/app/channel.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-07-05 09:06:55 -0400
committerHarrison Healey <harrisonmhealey@gmail.com>2017-07-05 09:06:55 -0400
commit4219d39e97bfe646e28696f9871fc8c1b8310154 (patch)
tree1feda604ab49c28fc1786edb406c329331d69766 /app/channel.go
parent0e1a9b7ebfd879359d9dfdcdf46b1919007b7b91 (diff)
downloadchat-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.go8
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