From d252e61c662479155081aeaf34fe0c6e4c3705d1 Mon Sep 17 00:00:00 2001 From: David Lu Date: Mon, 29 Aug 2016 09:51:29 -0400 Subject: Revert/Fix PLT-2805 (#3873) --- api/channel.go | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'api/channel.go') 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) } }() -- cgit v1.2.3-1-g7c22