0
0
Fork 0

Add blocked_by relationship to the REST API (#10373)

This commit is contained in:
Eugen Rochko 2019-03-26 01:24:09 +01:00 committed by GitHub
parent e6cfa7ab89
commit 9745de883b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View file

@ -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