From 65b76c2712eea4daa1633e4652fa3cd51037e854 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Fri, 27 Jan 2017 15:58:50 -0500 Subject: PLT-5225 Added separate post types for certain system messages (#5193) * Added separate post types for system_join_leave and system_add_remove posts * Added username prop to channel deleted posts * Changed slack import to properly generate the new join/leave messages * Added username prop to channel update posts * Moved Post(AddTo/RemoveFrom)ChanneMessage into app package --- app/slackimport.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'app/slackimport.go') diff --git a/app/slackimport.go b/app/slackimport.go index 3289f140e..e4beb3d3d 100644 --- a/app/slackimport.go +++ b/app/slackimport.go @@ -307,12 +307,23 @@ func SlackAddPosts(teamId string, channel *model.Channel, posts []SlackPost, use l4g.Debug(utils.T("api.slackimport.slack_add_posts.user_no_exists.debug"), sPost.User) continue } + + var postType string + if sPost.SubType == "channel_join" { + postType = model.POST_JOIN_CHANNEL + } else { + postType = model.POST_LEAVE_CHANNEL + } + newPost := model.Post{ UserId: users[sPost.User].Id, ChannelId: channel.Id, Message: sPost.Text, CreateAt: SlackConvertTimeStamp(sPost.TimeStamp), - Type: model.POST_JOIN_LEAVE, + Type: postType, + Props: model.StringInterface{ + "username": users[sPost.User].Username, + }, } ImportPost(&newPost) case sPost.Type == "message" && sPost.SubType == "me_message": -- cgit v1.2.3-1-g7c22