diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2019-03-26 01:24:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-26 01:24:09 +0100 |
commit | 9745de883b198375ba23f7fde879f6d75ce2df0f (patch) | |
tree | 1ad05b94a50be048d55b7459f63c6ec71f80db52 /app/serializers | |
parent | e6cfa7ab897ac4fd6bf9bbcafe09fc42c4cc2c5d (diff) |
Add `blocked_by` relationship to the REST API (#10373)
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/rest/relationship_serializer.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/serializers/rest/relationship_serializer.rb b/app/serializers/rest/relationship_serializer.rb index c6c722a54..1a3fd915c 100644 --- a/app/serializers/rest/relationship_serializer.rb +++ b/app/serializers/rest/relationship_serializer.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class REST::RelationshipSerializer < ActiveModel::Serializer - attributes :id, :following, :showing_reblogs, :followed_by, :blocking, + attributes :id, :following, :showing_reblogs, :followed_by, :blocking, :blocked_by, :muting, :muting_notifications, :requested, :domain_blocking, :endorsed @@ -27,6 +27,10 @@ class REST::RelationshipSerializer < ActiveModel::Serializer instance_options[:relationships].blocking[object.id] || false end + def blocked_by + instance_options[:relationships].blocked_by[object.id] || false + end + def muting instance_options[:relationships].muting[object.id] ? true : false end |