diff options
Diffstat (limited to 'api/channel.go')
-rw-r--r-- | api/channel.go | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/api/channel.go b/api/channel.go index a07f45d7a..faa39e13c 100644 --- a/api/channel.go +++ b/api/channel.go @@ -354,7 +354,7 @@ func PostUpdateChannelHeaderMessage(c *Context, channelId string, oldChannelHead Type: model.POST_HEADER_CHANGE, UserId: c.Session.UserId, } - if _, err := CreatePost(c.TeamId, post, false); err != nil { + if _, err := CreatePost(c, post, false); err != nil { l4g.Error(utils.T("api.channel.post_update_channel_header_message_and_forget.join_leave.error"), err) } } @@ -546,7 +546,7 @@ func PostUserAddRemoveMessage(c *Context, channelId string, message, postType st Type: postType, UserId: c.Session.UserId, } - if _, err := CreatePost(c.TeamId, post, false); err != nil { + if _, err := CreatePost(c, post, false); err != nil { l4g.Error(utils.T("api.channel.post_user_add_remove_message_and_forget.error"), err) } } @@ -618,7 +618,16 @@ func JoinDefaultChannels(teamId string, user *model.User, channelRole string) *m Type: model.POST_JOIN_LEAVE, UserId: user.Id, } - if _, err := CreatePost(teamId, post, false); err != nil { + + fakeContext := &Context{ + Session: model.Session{ + UserId: user.Id, + }, + TeamId: teamId, + T: utils.TfuncWithFallback(user.Locale), + } + + if _, err := CreatePost(fakeContext, post, false); err != nil { l4g.Error(utils.T("api.channel.post_user_add_remove_message_and_forget.error"), err) } } @@ -794,7 +803,7 @@ func deleteChannel(c *Context, w http.ResponseWriter, r *http.Request) { Type: model.POST_CHANNEL_DELETED, UserId: c.Session.UserId, } - if _, err := CreatePost(c.TeamId, post, false); err != nil { + if _, err := CreatePost(c, post, false); err != nil { l4g.Error(utils.T("api.channel.delete_channel.failed_post.error"), err) } }() |