diff options
author | David Lu <david.lu97@outlook.com> | 2016-08-29 09:51:29 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-08-29 09:51:29 -0400 |
commit | d252e61c662479155081aeaf34fe0c6e4c3705d1 (patch) | |
tree | 215df6f5c73009bebcae4a0fdfacdb2b3252c23b /api/channel.go | |
parent | 167dd22eefeeeb9c1eaebd990a4f5902bd366302 (diff) | |
download | chat-d252e61c662479155081aeaf34fe0c6e4c3705d1.tar.gz chat-d252e61c662479155081aeaf34fe0c6e4c3705d1.tar.bz2 chat-d252e61c662479155081aeaf34fe0c6e4c3705d1.zip |
Revert/Fix PLT-2805 (#3873)
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) } }() |