mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 06:04:11 +08:00
f3fdc7a6e8
When the client received a new notification, it prioritized only PM notifications instead of maintaining the priority order. Later, the check for missing notification deleted all notifications that were in the wrong order because it could not match the IDs. The correct order puts high_priority AND unread notifications first. Low priority or read notifications (including high priority, but read notifications) come after.
52 lines
950 B
Ruby
52 lines
950 B
Ruby
# frozen_string_literal: true
|
|
|
|
class NotificationSerializer < ApplicationSerializer
|
|
|
|
attributes :id,
|
|
:user_id,
|
|
:external_id,
|
|
:notification_type,
|
|
:read,
|
|
:high_priority,
|
|
:created_at,
|
|
:post_number,
|
|
:topic_id,
|
|
:fancy_title,
|
|
:slug,
|
|
:data,
|
|
:is_warning
|
|
|
|
def slug
|
|
Slug.for(object.topic.title) if object.topic.present?
|
|
end
|
|
|
|
def is_warning
|
|
object.topic.present? && object.topic.subtype == TopicSubtype.moderator_warning
|
|
end
|
|
|
|
def include_fancy_title?
|
|
object.topic&.fancy_title
|
|
end
|
|
|
|
def fancy_title
|
|
object.topic.fancy_title
|
|
end
|
|
|
|
def include_is_warning?
|
|
is_warning
|
|
end
|
|
|
|
def data
|
|
object.data_hash
|
|
end
|
|
|
|
def external_id
|
|
object.user&.single_sign_on_record&.external_id
|
|
end
|
|
|
|
def include_external_id?
|
|
SiteSetting.enable_discourse_connect
|
|
end
|
|
|
|
end
|