diff options
author | George Goldberg <george@gberg.me> | 2017-01-18 20:47:32 +0000 |
---|---|---|
committer | enahum <nahumhbl@gmail.com> | 2017-01-18 17:47:32 -0300 |
commit | 8cf4a8d2d7650204384293106d47468edf09eb91 (patch) | |
tree | c9f08116e4dc957c7fe09e766e63663f3fdb9736 /api | |
parent | f9b57b65ea8841276cc2803399341566ea875062 (diff) | |
download | chat-8cf4a8d2d7650204384293106d47468edf09eb91.tar.gz chat-8cf4a8d2d7650204384293106d47468edf09eb91.tar.bz2 chat-8cf4a8d2d7650204384293106d47468edf09eb91.zip |
PLT-4845: Slack import of channel purpose changed messages. (#5110)
Also includes channel header changed messages and channel name changed
messages.
Diffstat (limited to 'api')
-rw-r--r-- | api/slackimport.go | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/api/slackimport.go b/api/slackimport.go index 2db1b44f0..9d432b987 100644 --- a/api/slackimport.go +++ b/api/slackimport.go @@ -331,6 +331,54 @@ func SlackAddPosts(teamId string, channel *model.Channel, posts []SlackPost, use CreateAt: SlackConvertTimeStamp(sPost.TimeStamp), } ImportPost(&newPost) + case sPost.Type == "message" && sPost.SubType == "channel_topic": + if sPost.User == "" { + l4g.Debug(utils.T("api.slackimport.slack_add_posts.msg_no_usr.debug")) + continue + } else if users[sPost.User] == nil { + l4g.Debug(utils.T("api.slackimport.slack_add_posts.user_no_exists.debug"), sPost.User) + continue + } + newPost := model.Post{ + UserId: users[sPost.User].Id, + ChannelId: channel.Id, + Message: sPost.Text, + CreateAt: SlackConvertTimeStamp(sPost.TimeStamp), + Type: model.POST_HEADER_CHANGE, + } + ImportPost(&newPost) + case sPost.Type == "message" && sPost.SubType == "channel_purpose": + if sPost.User == "" { + l4g.Debug(utils.T("api.slackimport.slack_add_posts.msg_no_usr.debug")) + continue + } else if users[sPost.User] == nil { + l4g.Debug(utils.T("api.slackimport.slack_add_posts.user_no_exists.debug"), sPost.User) + continue + } + newPost := model.Post{ + UserId: users[sPost.User].Id, + ChannelId: channel.Id, + Message: sPost.Text, + CreateAt: SlackConvertTimeStamp(sPost.TimeStamp), + Type: model.POST_PURPOSE_CHANGE, + } + ImportPost(&newPost) + case sPost.Type == "message" && sPost.SubType == "channel_name": + if sPost.User == "" { + l4g.Debug(utils.T("api.slackimport.slack_add_posts.msg_no_usr.debug")) + continue + } else if users[sPost.User] == nil { + l4g.Debug(utils.T("api.slackimport.slack_add_posts.user_no_exists.debug"), sPost.User) + continue + } + newPost := model.Post{ + UserId: users[sPost.User].Id, + ChannelId: channel.Id, + Message: sPost.Text, + CreateAt: SlackConvertTimeStamp(sPost.TimeStamp), + Type: model.POST_DISPLAYNAME_CHANGE, + } + ImportPost(&newPost) default: l4g.Warn(utils.T("api.slackimport.slack_add_posts.unsupported.warn"), sPost.Type, sPost.SubType) } |