diff options
author | Thibaut Girka <thib@sitedethib.com> | 2019-03-11 11:23:50 +0100 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2019-03-11 11:23:50 +0100 |
commit | 89bee860cdae399b796814f80a48eafa8b838d92 (patch) | |
tree | 7f31aaa85f78b170f22cadd8c53fca8d09f8e795 /app/serializers | |
parent | 3cef04610cd809c7bd01adc00d34fb3d25261a16 (diff) | |
parent | 13a7f05030cdcbab24aeb25944a9a430238dbff1 (diff) |
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts: - app/services/post_status_service.rb Small conflict due to handling of instance-local toots. A subsequent change is required to ensure instance-local polls are not leaked through Update.
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/activitypub/update_poll_serializer.rb | 27 | ||||
-rw-r--r-- | app/serializers/rest/notification_serializer.rb | 2 |
2 files changed, 28 insertions, 1 deletions
diff --git a/app/serializers/activitypub/update_poll_serializer.rb b/app/serializers/activitypub/update_poll_serializer.rb new file mode 100644 index 000000000..f7933346f --- /dev/null +++ b/app/serializers/activitypub/update_poll_serializer.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class ActivityPub::UpdatePollSerializer < ActiveModel::Serializer + attributes :id, :type, :actor, :to + + has_one :object, serializer: ActivityPub::NoteSerializer + + def id + [ActivityPub::TagManager.instance.uri_for(object), '#updates/', object.poll.updated_at.to_i].join + end + + def type + 'Update' + end + + def actor + ActivityPub::TagManager.instance.uri_for(object) + end + + def to + ActivityPub::TagManager.instance.to(object) + end + + def cc + ActivityPub::TagManager.instance.cc(object) + end +end diff --git a/app/serializers/rest/notification_serializer.rb b/app/serializers/rest/notification_serializer.rb index 541a6b8b5..80812ad0d 100644 --- a/app/serializers/rest/notification_serializer.rb +++ b/app/serializers/rest/notification_serializer.rb @@ -11,6 +11,6 @@ class REST::NotificationSerializer < ActiveModel::Serializer end def status_type? - [:favourite, :reblog, :mention].include?(object.type) + [:favourite, :reblog, :mention, :poll].include?(object.type) end end |