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:
Bianca Nenciu
2021-07-27 14:05:33 +03:00
committed by GitHub
parent d801e33e0b
commit 760c9a5698
11 changed files with 106 additions and 3 deletions

View File

@ -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