about summary refs log tree commit diff
path: root/app/serializers
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-12-15 18:50:11 +0100
committerGitHub <noreply@github.com>2022-12-15 18:50:11 +0100
commit70415714f14e067aba518a105c96475db31fa124 (patch)
tree6a5e3bb7bec28809235025af12994b70c1082f5f /app/serializers
parent7a3c6bb88833a48253eb4795f4ee1127c6b5b5b0 (diff)
Add follow request banner on account header (#20785)
* Add requested_by to relationship maps

* Display whether an account has requested to follow you on their profile
Diffstat (limited to 'app/serializers')
-rw-r--r--app/serializers/rest/relationship_serializer.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/serializers/rest/relationship_serializer.rb b/app/serializers/rest/relationship_serializer.rb
index 31fc60eb2..b53387401 100644
--- a/app/serializers/rest/relationship_serializer.rb
+++ b/app/serializers/rest/relationship_serializer.rb
@@ -2,8 +2,8 @@
 
 class REST::RelationshipSerializer < ActiveModel::Serializer
   attributes :id, :following, :showing_reblogs, :notifying, :languages, :followed_by,
-             :blocking, :blocked_by, :muting, :muting_notifications, :requested,
-             :domain_blocking, :endorsed, :note
+             :blocking, :blocked_by, :muting, :muting_notifications,
+             :requested, :requested_by, :domain_blocking, :endorsed, :note
 
   def id
     object.id.to_s
@@ -54,6 +54,10 @@ class REST::RelationshipSerializer < ActiveModel::Serializer
     instance_options[:relationships].requested[object.id] ? true : false
   end
 
+  def requested_by
+    instance_options[:relationships].requested_by[object.id] ? true : false
+  end
+
   def domain_blocking
     instance_options[:relationships].domain_blocking[object.id] || false
   end