diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-08-03 13:47:20 -0500 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-08-03 13:47:20 -0500 |
commit | b644f1c5050c96fd95b573cac1f406e6d85446c9 (patch) | |
tree | 005c23d9688b5cc3323f6dda060e1d5f1724ba8e /app/serializers | |
parent | cd52f7500603ab82f18d651161e8ab7ca3565e35 (diff) |
respect 'don't @ me' requests
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/activitypub/note_serializer.rb | 10 | ||||
-rw-r--r-- | app/serializers/rest/status_serializer.rb | 6 |
2 files changed, 13 insertions, 3 deletions
diff --git a/app/serializers/activitypub/note_serializer.rb b/app/serializers/activitypub/note_serializer.rb index 56975ed80..ff39c97c4 100644 --- a/app/serializers/activitypub/note_serializer.rb +++ b/app/serializers/activitypub/note_serializer.rb @@ -2,12 +2,14 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer context_extensions :conversation, :sensitive, :big, - :hashtag, :emoji, :focal_point, :blurhash + :hashtag, :emoji, :focal_point, :blurhash, + :reject_replies attributes :id, :type, :summary, :in_reply_to, :published, :url, :attributed_to, :to, :cc, :sensitive, - :conversation, :source, :tails_never_fail + :conversation, :source, :tails_never_fail, + :reject_replies attribute :content attribute :content_map, if: :language? @@ -143,6 +145,10 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer object.preloadable_poll&.expired? end + def reject_replies + object.reject_replies == true + end + def tails_never_fail true end diff --git a/app/serializers/rest/status_serializer.rb b/app/serializers/rest/status_serializer.rb index 58ee81d1a..7146d8108 100644 --- a/app/serializers/rest/status_serializer.rb +++ b/app/serializers/rest/status_serializer.rb @@ -4,7 +4,7 @@ class REST::StatusSerializer < ActiveModel::Serializer attributes :id, :created_at, :in_reply_to_id, :in_reply_to_account_id, :sensitive, :spoiler_text, :visibility, :language, :uri, :url, :replies_count, :reblogs_count, - :favourites_count, :network, :curated + :favourites_count, :network, :curated, :reject_replies attribute :favourited, if: :current_user? attribute :reblogged, if: :current_user? @@ -140,6 +140,10 @@ class REST::StatusSerializer < ActiveModel::Serializer object.delete_after end + def reject_replies + object.reject_replies == true + end + class ApplicationSerializer < ActiveModel::Serializer attributes :name, :website end |