From 1f6047a43fe6ed0d0876d1f1740c1f215d8d9f1d Mon Sep 17 00:00:00 2001 From: KMY Date: Thu, 14 Sep 2023 19:13:17 +0900 Subject: [PATCH] Add expiration/limited/reference icon on timeline --- app/javascript/mastodon/components/status.jsx | 7 +++++++ app/serializers/rest/status_serializer.rb | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/app/javascript/mastodon/components/status.jsx b/app/javascript/mastodon/components/status.jsx index 257e90d1c1..0f18e4be9e 100644 --- a/app/javascript/mastodon/components/status.jsx +++ b/app/javascript/mastodon/components/status.jsx @@ -585,6 +585,10 @@ class Status extends ImmutablePureComponent { const {statusContentProps, hashtagBar} = getHashtagBarForStatus(status); const expanded = !status.get('hidden') + const withLimited = status.get('visibility_ex') === 'limited' && status.get('limited_scope') ? : null; + const withReference = status.get('status_references_count') > 0 ? : null; + const withExpiration = status.get('expires_at') ? : null; + return (
@@ -596,6 +600,9 @@ class Status extends ImmutablePureComponent { {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}
+ {withReference} + {withExpiration} + {withLimited} {status.get('edited_at') && *} diff --git a/app/serializers/rest/status_serializer.rb b/app/serializers/rest/status_serializer.rb index e53fb535bc..9919b831cb 100644 --- a/app/serializers/rest/status_serializer.rb +++ b/app/serializers/rest/status_serializer.rb @@ -15,6 +15,7 @@ class REST::StatusSerializer < ActiveModel::Serializer attribute :bookmarked, if: :current_user? attribute :pinned, if: :pinnable? attribute :reactions, if: :reactions? + attribute :expires_at, if: :will_expire? has_many :filtered, serializer: REST::FilterResultSerializer, if: :current_user? attribute :content, unless: :source_requested? @@ -205,6 +206,14 @@ class REST::StatusSerializer < ActiveModel::Serializer object.active_mentions.to_a.sort_by(&:id) end + def will_expire? + object.scheduled_expiration_status.present? + end + + def expires_at + object.scheduled_expiration_status.scheduled_at + end + private def relationships