From baf54aaf8ddc114ac352278231e41cc599c13d45 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sat, 15 Oct 2016 01:54:40 +0200 Subject: [PATCH] Fixed twitter reply issue with multiple recipients. --- .../ticket_zoom/article_actions.coffee | 4 ++-- .../controllers/ticket_zoom/article_new.coffee | 15 +++++++++++---- lib/tweet_base.rb | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/article_actions.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/article_actions.coffee index f060c8e68..a7ae281b7 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/article_actions.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/article_actions.coffee @@ -211,12 +211,12 @@ class App.TicketZoomArticleActions extends App.Controller recipients = article.from if article.to if recipients - recipients += ' ' + recipients += ', ' recipients += article.to if recipients recipientString = '' - recipientScreenNames = recipients.split(' ') + recipientScreenNames = recipients.split(',') for recipientScreenName in recipientScreenNames # exclude already listed screen name diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/article_new.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/article_new.coffee index 20c2e183c..e87088d3b 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/article_new.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/article_new.coffee @@ -295,21 +295,29 @@ class App.TicketZoomArticleNew extends App.Controller if params.type is 'twitter status' rawHTML = @$('[data-name=body]').html() cleanHTML = App.Utils.htmlRemoveRichtext(rawHTML) - if cleanHTML && cleanHTML.html() != rawHTML + + # if markup is included, strip it out + if cleanHTML && cleanHTML.html() isnt rawHTML && "
#{cleanHTML.html()}
" isnt rawHTML @$('[data-name=body]').html(cleanHTML) params.content_type = 'text/plain' params.body = "#{App.Utils.html2text(params.body, true)}\n#{@signature.text()}" + if params.type is 'twitter direct-message' rawHTML = @$('[data-name=body]').html() cleanHTML = App.Utils.htmlRemoveRichtext(rawHTML) - if cleanHTML && cleanHTML.html() != rawHTML + + # if markup is included, strip it out + if cleanHTML && cleanHTML.html() isnt rawHTML && "
#{cleanHTML.html()}
" isnt rawHTML @$('[data-name=body]').html(cleanHTML) params.content_type = 'text/plain' params.body = "#{App.Utils.html2text(params.body, true)}\n#{@signature.text()}" + if params.type is 'facebook feed comment' rawHTML = @$('[data-name=body]').html() cleanHTML = App.Utils.htmlRemoveRichtext(rawHTML) - if cleanHTML && cleanHTML.html() != rawHTML + + # if markup is included, strip it out + if cleanHTML && cleanHTML.html() isnt rawHTML && "
#{cleanHTML.html()}
" isnt rawHTML @$('[data-name=body]').html(cleanHTML) params.content_type = 'text/plain' params.body = App.Utils.html2text(params.body, true) @@ -372,7 +380,6 @@ class App.TicketZoomArticleNew extends App.Controller return false if params.type is 'twitter status' - params.body textLength = @maxTextLength - params.body.length return false if textLength < 0 diff --git a/lib/tweet_base.rb b/lib/tweet_base.rb index 1244541cb..0318c1714 100644 --- a/lib/tweet_base.rb +++ b/lib/tweet_base.rb @@ -163,7 +163,7 @@ class TweetBase if !to to = '' else - to + ', ' + to += ', ' end to += "@#{local_user.screen_name}" }