FIX: Remove markers from all translated languages (#14081)

Emails can include the marker in a different language, depending on
site and user settings. The email receiver always looked for the marker
in default language.
This commit is contained in:
Bianca Nenciu
2021-08-18 19:42:04 +03:00
committed by GitHub
parent 7db3888f17
commit 5c9abab0cd
4 changed files with 58 additions and 2 deletions

View File

@@ -549,11 +549,19 @@ module Email
end
def previous_replies_regex
@previous_replies_regex ||= /^--[- ]\n\*#{I18n.t("user_notifications.previous_discussion")}\*\n/im
strings = I18n.available_locales.map do |locale|
I18n.with_locale(locale) { I18n.t("user_notifications.previous_discussion") }
end.uniq
@previous_replies_regex ||= /^--[- ]\n\*(?:#{strings.map { |x| Regexp.escape(x) }.join("|")})\*\n/im
end
def reply_above_line_regex
@reply_above_line_regex ||= /\n#{I18n.t("user_notifications.reply_above_line")}\n/im
strings = I18n.available_locales.map do |locale|
I18n.with_locale(locale) { I18n.t("user_notifications.reply_above_line") }
end.uniq
@reply_above_line_regex ||= /\n(?:#{strings.map { |x| Regexp.escape(x) }.join("|")})\n/im
end
def trim_discourse_markers(reply)