mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 20:59:56 +08:00
PERF: remove uneeded data, notification count is pointless
Getting notification count is expensive, no point shipping it to clients
This commit is contained in:
parent
f6bc46937b
commit
0b9322d16a
@ -170,7 +170,6 @@
|
|||||||
{{#link-to 'user.notifications'}}
|
{{#link-to 'user.notifications'}}
|
||||||
{{fa-icon "comment" class="glyph"}}
|
{{fa-icon "comment" class="glyph"}}
|
||||||
{{i18n 'user.notifications'}}
|
{{i18n 'user.notifications'}}
|
||||||
<span class='count'>({{model.notification_count}})</span>
|
|
||||||
{{/link-to}}
|
{{/link-to}}
|
||||||
{{/link-to}}
|
{{/link-to}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
@ -60,7 +60,6 @@ class UserSerializer < BasicUserSerializer
|
|||||||
:suspended_till,
|
:suspended_till,
|
||||||
:uploaded_avatar_id,
|
:uploaded_avatar_id,
|
||||||
:badge_count,
|
:badge_count,
|
||||||
:notification_count,
|
|
||||||
:has_title_badges,
|
:has_title_badges,
|
||||||
:edit_history_public,
|
:edit_history_public,
|
||||||
:custom_fields,
|
:custom_fields,
|
||||||
@ -93,7 +92,6 @@ class UserSerializer < BasicUserSerializer
|
|||||||
:tracked_category_ids,
|
:tracked_category_ids,
|
||||||
:watched_category_ids,
|
:watched_category_ids,
|
||||||
:private_messages_stats,
|
:private_messages_stats,
|
||||||
:notification_count,
|
|
||||||
:disable_jump_reply,
|
:disable_jump_reply,
|
||||||
:gravatar_avatar_upload_id,
|
:gravatar_avatar_upload_id,
|
||||||
:custom_avatar_upload_id,
|
:custom_avatar_upload_id,
|
||||||
@ -292,10 +290,6 @@ class UserSerializer < BasicUserSerializer
|
|||||||
object.badges.where(allow_title: true).count > 0
|
object.badges.where(allow_title: true).count > 0
|
||||||
end
|
end
|
||||||
|
|
||||||
def notification_count
|
|
||||||
Notification.where(user_id: object.id).count
|
|
||||||
end
|
|
||||||
|
|
||||||
def include_edit_history_public?
|
def include_edit_history_public?
|
||||||
can_edit && !SiteSetting.edit_history_visible_to_public
|
can_edit && !SiteSetting.edit_history_visible_to_public
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user