diff options
author | George Goldberg <george@gberg.me> | 2017-03-17 16:29:26 +0000 |
---|---|---|
committer | George Goldberg <george@gberg.me> | 2017-03-17 16:29:26 +0000 |
commit | 7f266c19511171f509ae8a60170de10c8d10b41e (patch) | |
tree | 04cd68ac4722313abec3ea47cc7cda229e463b1d /app/import.go | |
parent | bfae88e60c7a623afae82e06ce1421ca778c06e7 (diff) | |
parent | 8568afe5b4fb4d26b14fbc0d21f088eaa490b314 (diff) | |
download | chat-7f266c19511171f509ae8a60170de10c8d10b41e.tar.gz chat-7f266c19511171f509ae8a60170de10c8d10b41e.tar.bz2 chat-7f266c19511171f509ae8a60170de10c8d10b41e.zip |
Merge branch 'release-3.7' into master.
Diffstat (limited to 'app/import.go')
-rw-r--r-- | app/import.go | 35 |
1 files changed, 3 insertions, 32 deletions
diff --git a/app/import.go b/app/import.go index 1ca532902..a5ed69843 100644 --- a/app/import.go +++ b/app/import.go @@ -865,7 +865,7 @@ func OldImportUser(team *model.Team, user *model.User) *model.User { l4g.Error(utils.T("api.import.import_user.set_email.error"), cresult.Err) } - if err := JoinUserToTeam(team, user); err != nil { + if err := JoinUserToTeam(team, user, utils.GetSiteURL()); err != nil { l4g.Error(utils.T("api.import.import_user.join_team.error"), err) } @@ -915,37 +915,8 @@ func OldImportIncomingWebhookPost(post *model.Post, props model.StringInterface) if len(props) > 0 { for key, val := range props { if key == "attachments" { - if list, success := val.([]interface{}); success { - // parse attachment links into Markdown format - for i, aInt := range list { - attachment := aInt.(map[string]interface{}) - if aText, ok := attachment["text"].(string); ok { - aText = linkWithTextRegex.ReplaceAllString(aText, "[${2}](${1})") - attachment["text"] = aText - list[i] = attachment - } - if aText, ok := attachment["pretext"].(string); ok { - aText = linkWithTextRegex.ReplaceAllString(aText, "[${2}](${1})") - attachment["pretext"] = aText - list[i] = attachment - } - if fVal, ok := attachment["fields"]; ok { - if fields, ok := fVal.([]interface{}); ok { - // parse attachment field links into Markdown format - for j, fInt := range fields { - field := fInt.(map[string]interface{}) - if fValue, ok := field["value"].(string); ok { - fValue = linkWithTextRegex.ReplaceAllString(fValue, "[${2}](${1})") - field["value"] = fValue - fields[j] = field - } - } - attachment["fields"] = fields - list[i] = attachment - } - } - } - post.AddProp(key, list) + if attachments, success := val.([]*model.SlackAttachment); success { + parseSlackAttachment(post, attachments) } } else if key != "from_webhook" { post.AddProp(key, val) |