mirror of
https://github.com/discourse/discourse.git
synced 2025-06-05 14:07:30 +08:00
FEATURE: Show draft count in user menu and activity (#13812)
This commit adds the number of drafts a user has next to the "Draft" label in the user preferences menu and activity tab. The count is updated via MessageBus when a draft is created or destroyed.
This commit is contained in:
@ -65,6 +65,7 @@ class CurrentUserSerializer < BasicUserSerializer
|
||||
:do_not_disturb_until,
|
||||
:has_topic_draft,
|
||||
:can_review,
|
||||
:draft_count,
|
||||
|
||||
def groups
|
||||
owned_group_ids = GroupUser.where(user_id: id, owner: true).pluck(:group_id).to_set
|
||||
@ -315,4 +316,8 @@ class CurrentUserSerializer < BasicUserSerializer
|
||||
def include_has_topic_draft?
|
||||
Draft.has_topic_draft(object)
|
||||
end
|
||||
|
||||
def draft_count
|
||||
object.user_stat.draft_count
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user