FIX: Use default locale for footer of embedded topics (#17760)

The content from the remote site and the footer get cached for 10 minutes, so Discourse should use the default locale instead of the user locale for the footer. Otherwise Discourse might cache the message in a different language.
This commit is contained in:
Gerhard Schlager
2022-08-02 20:49:28 +02:00
committed by GitHub
parent 5ac4e82540
commit f3b2ee8e1b
2 changed files with 17 additions and 1 deletions

View File

@@ -23,7 +23,9 @@ class TopicEmbed < ActiveRecord::Base
end
def self.imported_from_html(url)
"\n<hr>\n<small>#{I18n.t('embed.imported_from', link: "<a href='#{url}'>#{url}</a>")}</small>\n"
I18n.with_locale(SiteSetting.default_locale) do
"\n<hr>\n<small>#{I18n.t('embed.imported_from', link: "<a href='#{url}'>#{url}</a>")}</small>\n"
end
end
# Import an article from a source (RSS/Atom/Other)