diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2022-09-20 23:51:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-20 23:51:21 +0200 |
commit | 50948b46aabc0756d85bc6641f0bd3bcc09bf7d4 (patch) | |
tree | 19dd9e761aec2a33d6bc3c11b47673da40cd965b /app/serializers/rest | |
parent | 882e54c78678bd4247d70fe5b04571543769bcee (diff) |
Add ability to filter followed accounts' posts by language (#19095)
Diffstat (limited to 'app/serializers/rest')
-rw-r--r-- | app/serializers/rest/relationship_serializer.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/serializers/rest/relationship_serializer.rb b/app/serializers/rest/relationship_serializer.rb index afd4cddf9..31fc60eb2 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, :notifying, :followed_by, + attributes :id, :following, :showing_reblogs, :notifying, :languages, :followed_by, :blocking, :blocked_by, :muting, :muting_notifications, :requested, :domain_blocking, :endorsed, :note @@ -25,6 +25,11 @@ class REST::RelationshipSerializer < ActiveModel::Serializer false end + def languages + (instance_options[:relationships].following[object.id] || {})[:languages] || + (instance_options[:relationships].requested[object.id] || {})[:languages] + end + def followed_by instance_options[:relationships].followed_by[object.id] || false end |