1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Compare commits

...

3 commits

Author SHA1 Message Date
Bei Li
70db512408
Merge 33c1e2858e into 549ab089ee 2024-07-31 11:04:47 +00:00
Bei Li
33c1e2858e Add :display_name 2024-04-12 10:47:01 +09:00
Bei Li
d56ae18243 Add display_name to Web::NotificationSerializer 2024-04-11 23:12:41 +09:00

View file

@ -6,7 +6,7 @@ class Web::NotificationSerializer < ActiveModel::Serializer
include ActionView::Helpers::SanitizeHelper include ActionView::Helpers::SanitizeHelper
attributes :access_token, :preferred_locale, :notification_id, attributes :access_token, :preferred_locale, :notification_id,
:notification_type, :icon, :title, :body :notification_type, :icon, :display_name, :title, :body
def access_token def access_token
current_push_subscription.associated_access_token current_push_subscription.associated_access_token
@ -28,8 +28,12 @@ class Web::NotificationSerializer < ActiveModel::Serializer
full_asset_url(object.from_account.avatar_static_url) full_asset_url(object.from_account.avatar_static_url)
end end
def display_name
object.from_account.display_name.presence || object.from_account.username
end
def title def title
I18n.t("notification_mailer.#{object.type}.subject", name: object.from_account.display_name.presence || object.from_account.username) I18n.t("notification_mailer.#{object.type}.subject", name: display_name)
end end
def body def body