diff options
-rw-r--r-- | api/channel.go | 2 | ||||
-rw-r--r-- | api4/channel.go | 4 | ||||
-rw-r--r-- | app/channel.go | 6 |
3 files changed, 8 insertions, 4 deletions
diff --git a/api/channel.go b/api/channel.go index 73daaf3d4..c7b0630e6 100644 --- a/api/channel.go +++ b/api/channel.go @@ -124,7 +124,7 @@ func createGroupChannel(c *Context, w http.ResponseWriter, r *http.Request) { userIds = append(userIds, c.Session.UserId) } - if sc, err := app.CreateGroupChannel(userIds); err != nil { + if sc, err := app.CreateGroupChannel(userIds, c.Session.UserId); err != nil { c.Err = err return } else { diff --git a/api4/channel.go b/api4/channel.go index 493b012a0..6daf43c74 100644 --- a/api4/channel.go +++ b/api4/channel.go @@ -259,7 +259,7 @@ func createGroupChannel(c *Context, w http.ResponseWriter, r *http.Request) { return } - if groupChannel, err := app.CreateGroupChannel(userIds); err != nil { + if groupChannel, err := app.CreateGroupChannel(userIds, c.Session.UserId); err != nil { c.Err = err return } else { @@ -376,7 +376,7 @@ func getPublicChannelsForTeam(c *Context, w http.ResponseWriter, r *http.Request return } - if channels, err := app.GetPublicChannelsForTeam(c.Params.TeamId, c.Params.Page, c.Params.PerPage); err != nil { + if channels, err := app.GetPublicChannelsForTeam(c.Params.TeamId, c.Params.Page*c.Params.PerPage, c.Params.PerPage); err != nil { c.Err = err return } else { diff --git a/app/channel.go b/app/channel.go index ee53ace45..3e794a0c9 100644 --- a/app/channel.go +++ b/app/channel.go @@ -218,7 +218,7 @@ func WaitForChannelMembership(channelId string, userId string) { } } -func CreateGroupChannel(userIds []string) (*model.Channel, *model.AppError) { +func CreateGroupChannel(userIds []string, creatorId string) (*model.Channel, *model.AppError) { if len(userIds) > model.CHANNEL_GROUP_MAX_USERS || len(userIds) < model.CHANNEL_GROUP_MIN_USERS { return nil, model.NewAppError("CreateGroupChannel", "api.channel.create_group.bad_size.app_error", nil, "", http.StatusBadRequest) } @@ -261,6 +261,10 @@ func CreateGroupChannel(userIds []string) (*model.Channel, *model.AppError) { return nil, result.Err } + if user.Id == creatorId { + WaitForChannelMembership(group.Id, creatorId) + } + InvalidateCacheForUser(user.Id) } |