From bd06f59fbfb5e47971f083129eb92298aea0acbd Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Thu, 28 Apr 2016 16:20:23 +0200 Subject: [PATCH] Improved checkAttachmentReference(). --- .../javascripts/app/lib/app_post/utils.coffee | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/app/lib/app_post/utils.coffee b/app/assets/javascripts/app/lib/app_post/utils.coffee index e302073bc..d9d99a8eb 100644 --- a/app/assets/javascripts/app/lib/app_post/utils.coffee +++ b/app/assets/javascripts/app/lib/app_post/utils.coffee @@ -541,9 +541,17 @@ class App.Utils @checkAttachmentReference: (message) -> return false if !message return true if message.match(/attachment/i) - attachmentTranslated = App.i18n.translateContent('Attachment') - attachmentTranslatedRegExp = new RegExp( attachmentTranslated, 'i' ) - return true if message.match( attachmentTranslatedRegExp ) + matchwords = ['Attachment', 'attachment', 'Attached', 'attached', 'Enclosed', 'enclosed'] + for word in matchwords + + # en + attachmentTranslatedRegExp = new RegExp(word, 'i') + return true if message.match(attachmentTranslatedRegExp) + + # user locale + attachmentTranslated = App.i18n.translateContent(word) + attachmentTranslatedRegExp = new RegExp(attachmentTranslated, 'i') + return true if message.match(attachmentTranslatedRegExp) false # human readable file size