Skip to content
Snippets Groups Projects
Unverified Commit 0a199243 authored by Eugen Rochko's avatar Eugen Rochko Committed by GitHub
Browse files

Fix errors when rendering RSS feeds (#18531)

parent 52f4e834
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,7 @@ module FormattingHelper
before_html = begin
if status.spoiler_text?
"<p><strong>#{I18n.t('rss.content_warning', locale: valid_locale_or_nil(status.language))}</strong> #{h(status.spoiler_text)}</p><hr />"
"<p><strong>#{I18n.t('rss.content_warning', locale: available_locale_or_nil(status.language) || I18n.default_locale)}</strong> #{h(status.spoiler_text)}</p><hr />"
else
''
end
......
......@@ -254,4 +254,8 @@ module LanguagesHelper
def valid_locale?(locale)
locale.present? && SUPPORTED_LOCALES.key?(locale.to_sym)
end
def available_locale_or_nil(locale_name)
locale_name.to_sym if locale_name.present? && I18n.available_locales.include?(locale_name.to_sym)
end
end
......@@ -26,4 +26,10 @@ class RSS::MediaContent < RSS::Element
description['type'] = 'plain'
end
end
def thumbnail(str)
append_element('media:thumbnail') do |thumbnail|
thumbnail['url'] = str
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment