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
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
description['type'] = 'plain'
end
end
+
+ def thumbnail(str)
+ append_element('media:thumbnail') do |thumbnail|
+ thumbnail['url'] = str
+ end
+ end
end