diff --git a/app/assets/javascripts/app/lib/app_post/utils.coffee b/app/assets/javascripts/app/lib/app_post/utils.coffee index 810bee3eb..f29dbdfa6 100644 --- a/app/assets/javascripts/app/lib/app_post/utils.coffee +++ b/app/assets/javascripts/app/lib/app_post/utils.coffee @@ -816,21 +816,22 @@ class App.Utils # check if attachment is referenced in message @checkAttachmentReference: (message) -> return false if !message + + # remove blockquote from message, check only the unquoted content + tmp = $('
.*<\/blockquote>)/g, "").match(attachmentTranslatedRegExp) + return word if text.match(attachmentTranslatedRegExp) # user locale attachmentTranslated = App.i18n.translateContent(word) attachmentTranslatedRegExp = new RegExp("\\W#{attachmentTranslated}\\W", 'i') - - # remove blockquote, check only the unquoted content - return attachmentTranslated if message.replace(/(.*<\/blockquote>)/g, "").match(attachmentTranslatedRegExp) + return attachmentTranslated if text.match(attachmentTranslatedRegExp) false # human readable file size diff --git a/public/assets/tests/html_utils.js b/public/assets/tests/html_utils.js index acb98b33c..5b3bd77c3 100644 --- a/public/assets/tests/html_utils.js +++ b/public/assets/tests/html_utils.js @@ -1282,7 +1282,17 @@ test("check check attachment reference", function() { verify = App.Utils.checkAttachmentReference(message) equal(verify, result) - message = 'Hi Test,' + message = 'On Monday, 22 July 2019, 14:07:54, Test User wrote:
Test attachmentHi Test,' + result = false + verify = App.Utils.checkAttachmentReference(message) + equal(verify, result) + + message = 'On Monday, 22 July 2019, 14:07:54, Test User wrote:
Test attachmentHi Test,' + result = false + verify = App.Utils.checkAttachmentReference(message) + equal(verify, result) + + message = 'cite attachmentHi Test,' result = false verify = App.Utils.checkAttachmentReference(message) equal(verify, result)ecxgmail_quote attachment