Messages section for sidebar

:information_source: Summary Adds personal and group message inbox links to the sidebar, including unread message indicators
:eyeglasses: Preview Theme Creator
:hammer_and_wrench: Repository GitHub - moin-Jana/sidebar-messages-section: Adds personal and group message inbox links to the sidebar, including unread message indicators.
:question: Install Guide How to install a theme or theme component
:open_book: New to Discourse Themes? Beginner’s guide to using Discourse Themes

Install this theme component

The component adds a Messages section to the sidebar with links to personal message inboxes - both the user’s personal inbox and any group inboxes they have access to. The section also includes a button for composing a new personal message next to the section heading.

Personal inbox

By default, the component adds a link to the personal inbox for all users. With the show_personal_inbox setting, admins can also hide it entirely or show it only for users who are allowed to create PMs based on the Personal message enabled groups site setting. This mirrors how the personal inbox link appears in the notifications menu, the user’s profile, and the Community section of the sidebar.

:bulb: To avoid duplicate links to the personal inbox, you may want to remove the messages link in the first section of the sidebar. You can do this by opening the More menu and selecting Customize this section, then remove the Messages link from the section.

Group inboxes

All group inboxes that contain at least one message and that the user is a member of will appear automatically in their sidebar. Admins can hide specific group inboxes using the hide_group_inboxes setting, which can be useful when a group inbox is no longer actively used.

Unread indicator

Each inbox link shows the current message state based on the user’s preference for “Show a count of the new items”: either a dot or the numeric count. Values above 100 are displayed as 99+.

13 Likes

wow, nicely done Moin! :clap: :tada:

3 Likes

Minor suggestion: perhaps javascripts/discourse/api-initializers/group-inboxes-in-sidebar.gjs should be a JS file instead of GJS?

Great component!


I spent the last 10 minutes looking through the code and examining core classes and I must say how remarkable Discourse was (and is) made such that everything fits in so well.

2 Likes

Yes, the API offers almost everything you need to make the section look and work like all the others. The chat uses it too, which probably influenced the development; the features were developed at the same time.

Unfortunately, get badgeText(), which displays the number of unread topics in the core sections, is not supported, so I had to get a little creative with the numbers.

4 Likes

I couldn’t find an admin setting for this, so PSA this will hide it via CSS:

.sidebar-section-link[data-link-name="my-messages"] {
    display: none;
}

@Moin, could this be a checkbox in the theme component to hide it?

1 Like

Why do you prefer the link to be hidden with CSS instead of using the existing option for admins to customize the sidebar? Hiding with CSS seems more likely to break than using built in Discourse options.

2 Likes

Derp, you’re right. I was overthinking it, thinking it would be a setting in the admin console and/or core functionality.

1 Like

You’re not the only one that was looking there. :joy:


This is a sweet component!

1 Like

I expanded the note:

2 Likes

Yes you did. But as admins we are often used to going through the admin panel. :wink:. Do when skimming instructions we might gloss over some details.

Even with core updates I am sure many of us don’t always read over all the fine details until something we use has been moved to another area

Long long ago with Android for example iirc Gingerbread use to have Nav & Maps. I spent about 10m looking for Nav after they merged it with Maps in an update. :joy: