Add notification policies and notification requests (#29366)
This commit is contained in:
parent
653ce43abe
commit
50b17f7e10
104 changed files with 1096 additions and 247 deletions
16
app/serializers/rest/notification_policy_serializer.rb
Normal file
16
app/serializers/rest/notification_policy_serializer.rb
Normal file
|
@ -0,0 +1,16 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class REST::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_s,
|
||||
pending_notifications_count: object.pending_notifications_count.to_s,
|
||||
}
|
||||
end
|
||||
end
|
16
app/serializers/rest/notification_request_serializer.rb
Normal file
16
app/serializers/rest/notification_request_serializer.rb
Normal file
|
@ -0,0 +1,16 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class REST::NotificationRequestSerializer < ActiveModel::Serializer
|
||||
attributes :id, :created_at, :updated_at, :notifications_count
|
||||
|
||||
belongs_to :from_account, key: :account, serializer: REST::AccountSerializer
|
||||
belongs_to :last_status, serializer: REST::StatusSerializer
|
||||
|
||||
def id
|
||||
object.id.to_s
|
||||
end
|
||||
|
||||
def notifications_count
|
||||
object.notifications_count.to_s
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue