Improved checkAttachmentReference().

This commit is contained in:
Martin Edenhofer 2016-04-28 16:20:23 +02:00
parent 4366d60270
commit bd06f59fbf

View file

@ -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