summaryrefslogtreecommitdiffstats
path: root/app/serializers/rest/notification_group_serializer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/serializers/rest/notification_group_serializer.rb')
-rw-r--r--app/serializers/rest/notification_group_serializer.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/serializers/rest/notification_group_serializer.rb b/app/serializers/rest/notification_group_serializer.rb
index 9926efd430e..6c1d2465d25 100644
--- a/app/serializers/rest/notification_group_serializer.rb
+++ b/app/serializers/rest/notification_group_serializer.rb
@@ -5,6 +5,7 @@ class REST::NotificationGroupSerializer < ActiveModel::Serializer
attribute :page_min_id, if: :paginated?
attribute :page_max_id, if: :paginated?
+ attribute :latest_page_notification_at, if: :paginated?
has_many :sample_accounts, serializer: REST::AccountSerializer
belongs_to :target_status, key: :status, if: :status_type?, serializer: REST::StatusSerializer
@@ -33,6 +34,11 @@ class REST::NotificationGroupSerializer < ActiveModel::Serializer
range.present? ? range[:max_id].to_s : object.notification.id.to_s
end
+ def latest_page_notification_at
+ range = instance_options[:group_metadata][object.group_key]
+ range.present? ? range[:latest_notification_at] : object.notification.created_at
+ end
+
def paginated?
instance_options[:group_metadata].present?
end