From b9b8f1df46c42aff8e870d4257cdbad26a404918 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Fri, 4 Nov 2016 00:14:43 +0100 Subject: [PATCH] Fixed issue#286 - Answers from google mail shows complete quote. --- CHANGES.md | 1 + .../ticket_zoom/article_view.coffee | 2 ++ .../javascripts/app/lib/app_post/utils.coffee | 19 +++++++++++++++++-- public/assets/tests/html_utils.js | 11 +++++++++++ 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index fe85c3769..9fe5181a9 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,6 +4,7 @@ - 2016-10-28 Implemented issue#[317](https://github.com/zammad/zammad/issues/317) - Display origin url from tweet/facebook post in article view. ## Zammad 1.0.1 + - 2016-11-04 Fixed issue#[286](https://github.com/zammad/zammad/issues/286) - Answers from google mail shows complete quote. - 2016-11-03 Fixed issue#[348](https://github.com/zammad/zammad/issues/348) - IMAP mail fetching stops because of broken spam email (invalid Content-Transfer-Encoding header) - 2016-10-29 Fixed issue#[326](https://github.com/zammad/zammad/issues/326) - Create emails via fetchmail / procmail. - 2016-10-28 Fixed issue#[251](https://github.com/zammad/zammad/issues/251) - Page posts from facebook and tweets from twitter as tickets (new tickets from own posts / tweets will be created as closed now). diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/article_view.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/article_view.coffee index 4738e61ad..17b8029de 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/article_view.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/article_view.coffee @@ -97,6 +97,8 @@ class ArticleViewItem extends App.ObserverController body = body.split('
') body.splice(article.preferences.signature_detection, 0, signatureDetected) body = body.join('
') + else + body = App.Utils.signatureIdentify(body) article['html'] = body else diff --git a/app/assets/javascripts/app/lib/app_post/utils.coffee b/app/assets/javascripts/app/lib/app_post/utils.coffee index 0fc24917e..1ce7f98ea 100644 --- a/app/assets/javascripts/app/lib/app_post/utils.coffee +++ b/app/assets/javascripts/app/lib/app_post/utils.coffee @@ -403,7 +403,7 @@ class App.Utils lineCount = 0 for line in textToSearchInLines lineCount += 1 - if line && line.match( /^.{6,10}\s.{3,10}\s-\s.{1,250}\s(wrote|schrieb):/ ) + if line && line.match( /^.{6,10}\s.{3,10}\s-\s.{1,250}\s(wrote|schrieb|a écrit|escribió):/ ) marker = line: cleanup(line) lineCount: lineCount @@ -461,7 +461,7 @@ class App.Utils lineCount = 0 for line in textToSearchInLines lineCount += 1 - if line && line.match( /^.{1,250}\s(wrote|schrieb):/ ) + if line && line.match( /^.{1,250}\s(wrote|schrieb|a écrit|escribió):/ ) marker = line: cleanup(line) lineCount: lineCount @@ -470,6 +470,21 @@ class App.Utils return searchForWord14(textToSearchInLines, markers) + # gmail + # Am 24.10.2016 18:55 schrieb "xxx" : + searchForGmail = (textToSearchInLines, markers) -> + lineCount = 0 + for line in textToSearchInLines + lineCount += 1 + if line && line.match( /.{1,250}\s(wrote|schrieb|a écrit|escribió)\s.{1,250}:/ ) + marker = + line: cleanup(line) + lineCount: lineCount + type: 'gmail' + markers.push marker + return + searchForGmail(textToSearchInLines, markers) + # marker template markerTemplate = '' diff --git a/public/assets/tests/html_utils.js b/public/assets/tests/html_utils.js index 1971bdb8a..820aa3cf9 100644 --- a/public/assets/tests/html_utils.js +++ b/public/assets/tests/html_utils.js @@ -727,6 +727,17 @@ test("identify signature", function() { message = "

test 123

test 123

--

Bob Smith

" should = "

test 123

test 123

--

Bob Smith

" result = App.Utils.signatureIdentify(message, true) + equal(result, should) + + message = "Test reply to zammad

Am 24.10.2016 18:55 schrieb "Android Support" <android-support@example.com>:

>
> Sehr geehrte Damen" + should = "Test reply to zammad

Am 24.10.2016 18:55 schrieb "Android Support" <android-support@example.com>:

>
> Sehr geehrte Damen" + result = App.Utils.signatureIdentify(message, true) + equal(result, should) + + message = "
< On 20 Oct 2016, at 12:23, Martin Edenhofer via Zammad Helpdesk wrote:
" + should = "
< On 20 Oct 2016, at 12:23, Martin Edenhofer via Zammad Helpdesk wrote:
" + result = App.Utils.signatureIdentify(message, true) + equal(result, should) // apple // en