Revamp notification policy options (#31343)
This commit is contained in:
parent
e29c401f77
commit
cbdd8edf68
16 changed files with 442 additions and 109 deletions
32
app/serializers/rest/v1/notification_policy_serializer.rb
Normal file
32
app/serializers/rest/v1/notification_policy_serializer.rb
Normal file
|
@ -0,0 +1,32 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class REST::V1::NotificationPolicySerializer < ActiveModel::Serializer
|
||||
attributes :filter_not_following,
|
||||
:filter_not_followers,
|
||||
:filter_new_accounts,
|
||||
:filter_private_mentions,
|
||||
:summary
|
||||
|
||||
def summary
|
||||
{
|
||||
pending_requests_count: object.pending_requests_count.to_i,
|
||||
pending_notifications_count: object.pending_notifications_count.to_i,
|
||||
}
|
||||
end
|
||||
|
||||
def filter_not_following
|
||||
!object.accept_not_following?
|
||||
end
|
||||
|
||||
def filter_not_followers
|
||||
!object.accept_not_followers?
|
||||
end
|
||||
|
||||
def filter_new_accounts
|
||||
!object.accept_new_accounts?
|
||||
end
|
||||
|
||||
def filter_private_mentions
|
||||
!object.accept_private_mentions?
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue