סמלי תפריט משתמש בכותרת עם מחוון הודעה חדשה?

סיכום מבוסס בינה מלאכותית

In a support discussion titled ‘User menu messages glyph in header with new message indicator?’, paulrudy seeks help implementing a messages glyph in the header with a popup of recent messages, a new-message indicator, and removal of the glyph from the user menu—all within a theme without creating a plugin. He shares a working script that adds a static messages link but lacks the popup functionality. He references the user menu’s JavaScript code that generates the glyph and asks if it can be adapted for use in a theme. Ralf_Stockmann agrees the feature would be useful for their intranet and encourages others to respond. The discussion centers on theme customization limitations and potential workarounds to replicate core widget behavior in the header.

Hello Discourse wizards,

I’d like to do some or all of the following, if possible, within a theme (I don’t have think I have the chops to do understand how to make a plugin yet):

  1. insert the messages glyph from the user menu into the header, complete with its popup of recent messages.
  2. give this header messages glyph a new-message indicator (and remove it from the user avatar)
  3. remove the messages glyph from the user menu

I know that I can put a messages link in the header like so

<script type="text/discourse-plugin" version="0.8">
  const { iconNode } = require("discourse-common/lib/icon-library");
  api.decorateWidget('header-icons:before', helper => {
      return helper.h('li', [
          helper.h('a.icon', {
              href:'/my/messages',
              title: 'Messages'
          }, iconNode('envelope')),
      ]);
  });
</script>

But it lacks the popup.

I found the following code in the user menu js:

 if (this.siteSettings.enable_personal_messages || this.currentUser.staff) {
      glyphs.push(this.messagesGlyph());
    }

But I don’t know if I can apply it within a theme, or how.

Any help would be greatly appreciated!

This would be very handy for our intranet, too - anyone?