Skip to content

Move mod-note pip onto current-user avatar#23

Merged
Shalom-Karr merged 2 commits into
masterfrom
feat/mod-note-avatar-badge
May 20, 2026
Merged

Move mod-note pip onto current-user avatar#23
Shalom-Karr merged 2 commits into
masterfrom
feat/mod-note-avatar-badge

Conversation

@Shalom-Karr

Copy link
Copy Markdown
Owner

Summary

  • Pip moved from header logo area onto the current-user avatar itself as a small overlay badge.
  • Mirrors Discourse's native unread-reviewables / notifications-on-avatar pattern.
  • Same data flow as before: Ember observer on currentUser.mod_note_unread_count + MessageBus channel /mod-note-unread-count/{user_id}.
  • Badge uses pointer-events: none so clicks pass through to the avatar, opening the user menu (which already exposes the shield tab via api.registerUserMenuTab).

Implementation

  • mod-note-header-pip.gjs now renders an invisible placeholder and injects a .mod-note-avatar-pip child onto the avatar element via direct DOM manipulation. A MutationObserver on document.body re-attaches if Discourse re-renders the header. Tries multiple selectors so it works across Discourse versions.
  • mod-note-header-pip.scss rewritten to position the badge in the top-right corner of the avatar, using var(--tertiary) background with a 2px var(--header_background) border to separate it from the avatar. Shows "9+" when count > 9.
  • System spec selectors updated from .mod-note-header-pip / .mod-note-header-pip-count to .mod-note-avatar-pip / .mod-note-avatar-pip.visible, and the seen-ack poll reads dataset.count instead of textContent (the number is rendered via ::before { content: attr(data-count) }).

Test plan

  • Plugin QUnit passes
  • RSpec passes
  • RSpec (spec/saves) passes
  • RSpec (spec/system) passes — badge is visible on / for staff, hidden after opening the shield tab, and never present for regular users

Generated with Claude Code

Shalom-Karr and others added 2 commits May 20, 2026 00:41
The header pip was rendering as a button on the left side of the header
next to the Discourse logo. Move it onto the current-user avatar in the
top-right as a small overlay badge, mirroring Discourse's native pattern
for unread reviewables / notifications on the avatar.

The component now renders an invisible placeholder and injects a
`.mod-note-avatar-pip` child into the avatar element via direct DOM
manipulation, with a MutationObserver to re-attach if the header
re-renders. The badge uses `pointer-events: none` so clicks pass through
to the avatar and open the user menu (which already exposes the shield
tab). The data flow is unchanged: same Ember observer on the current
user + MessageBus channel `/mod-note-unread-count/{user_id}`.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Captures cropped header screenshots (193-197) of the moderator-notes
avatar pip at 0, 1, 5, 12+ (overflow), and after-seen so reviewers can
eyeball the badge before merging.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@Shalom-Karr
Shalom-Karr merged commit 83e4f7b into master May 20, 2026
4 checks passed
Shalom-Karr added a commit that referenced this pull request May 20, 2026
Adds the 5 close-up avatar-badge captures from PR #23 plus a refreshed 190 reflecting the new avatar-overlay design.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant