mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-07 03:59:09 +08:00
Localizes topic titles in these areas - user notification - bookmarks This commit also updates the user notification bookmark list to use fancy title instead of title, similar to the other user notification tabs.
29 lines
635 B
Ruby
29 lines
635 B
Ruby
# frozen_string_literal: true
|
|
|
|
module LocalizedFancyTopicTitleMixin
|
|
def self.included(klass)
|
|
klass.attributes :fancy_title
|
|
end
|
|
|
|
def fancy_title
|
|
f = _topic.fancy_title
|
|
|
|
if (ContentLocalization.show_translated_topic?(_topic, scope))
|
|
_topic.get_localization&.fancy_title.presence || f
|
|
else
|
|
f
|
|
end
|
|
end
|
|
|
|
def include_fancy_title?
|
|
_topic.present? && _topic&.fancy_title.present?
|
|
end
|
|
|
|
private
|
|
|
|
def _topic
|
|
return object if object.class == Topic
|
|
return topic if defined?(topic) && topic.class == Topic
|
|
object.topic if defined?(object.topic) && object.topic.class == Topic
|
|
end
|
|
end
|