/admin links in sidebar should be visible only to admins

I would like to add a link to /admin/plugins/discourse-ai/ai-personas to make it easier for a novice admin be able to find the place to edit AI personas (and maybe me too). The /admin link in that menu is visible only to admins, but when I add /admin/plugins/discourse-ai/ai-personas it’s visible to all users.

If that’s not a bug, is there some other way to add those links?

On a related note, for a Dicourse novice, it’s pretty complicated to figure out how to get there. For example, when trying to get to the AI configuration settings, the user ended up at https://meta.discourse.org/t/discourse-ai-plugin/259214 (by clicking the inviting blue link on the left rather than the apparently invisible AI link in the sub-menu above. :crying_cat_face:

5 Likes

One of my theme components can accomplish this with CSS. The code for hiding a link in the (old) community section at the top for everyone except staff is, (where #{$staff_link} is the name of that link):

.sidebar-section-link-wrapper[data-list-item-name="#{$staff_link}"] {
    display: none;
 }

.staff .sidebar-section-link-wrapper[data-list-item-name="#{$staff_link}"] {
    display: block;
}

1 Like