summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorGeorge Goldberg <george@gberg.me>2016-10-12 14:33:58 +0100
committerHarrison Healey <harrisonmhealey@gmail.com>2016-10-12 09:33:58 -0400
commit552508706d5ec4b87e67c0bf46609fb320ee7792 (patch)
tree4ea0e151856753257f7ce0aa700a6bd180a98174 /api
parent5ca05124cf2c4f106f0fef95546bd4b9d376af3e (diff)
downloadchat-552508706d5ec4b87e67c0bf46609fb320ee7792.tar.gz
chat-552508706d5ec4b87e67c0bf46609fb320ee7792.tar.bz2
chat-552508706d5ec4b87e67c0bf46609fb320ee7792.zip
Import /me messages from Slack. (#4164)
Use message formatting consistent with how Mattermost does for the /me command for new messages.
Diffstat (limited to 'api')
-rw-r--r--api/slackimport.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/api/slackimport.go b/api/slackimport.go
index 688d25370..bf18992f6 100644
--- a/api/slackimport.go
+++ b/api/slackimport.go
@@ -233,6 +233,21 @@ func SlackAddPosts(teamId string, channel *model.Channel, posts []SlackPost, use
Type: model.POST_JOIN_LEAVE,
}
ImportPost(&newPost)
+ case sPost.Type == "message" && sPost.SubType == "me_message":
+ if sPost.User == "" {
+ l4g.Debug(utils.T("api.slackimport.slack_add_posts.without_user.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),
+ }
+ ImportPost(&newPost)
default:
l4g.Warn(utils.T("api.slackimport.slack_add_posts.unsupported.warn"), sPost.Type, sPost.SubType)
}