PLT-5017 Fix import of Slack webhook/bot messages. (#4964)

This commit is contained in:
George Goldberg
2017-01-04 18:42:23 +00:00
committed by Corey Hulen
parent 4b1ffcb0bd
commit 95172f1b4b

View File

@@ -20,7 +20,10 @@ import (
//
func ImportPost(post *model.Post) {
for messageRuneCount := utf8.RuneCountInString(post.Message); messageRuneCount > 0; messageRuneCount = utf8.RuneCountInString(post.Message) {
// Workaround for empty messages, which may be the case if they are webhook posts.
firstIteration := true
for messageRuneCount := utf8.RuneCountInString(post.Message); messageRuneCount > 0 || firstIteration; messageRuneCount = utf8.RuneCountInString(post.Message) {
firstIteration = false
var remainder string
if messageRuneCount > model.POST_MESSAGE_MAX_RUNES {
remainder = string(([]rune(post.Message))[model.POST_MESSAGE_MAX_RUNES:])