Group-specific Sidebar Categories/Tags

One should be able to add certain categories/tags to the sidebar for specific groups. E.g. this would allow all members of a group to access their group category quickly without every group member having to set that up themselves.

This would also be consistent with how Discourse manages notification settings hierarchically (general site settings > group settings > user settings).

I’m thinking, this settings page would probably be an appropriate place to add a “Sidebar default categories” dropdown:

3 Likes

I’m encountering this issue at the moment too. But I’m also aware that it will add yet another layer of complexity to group config.

Building on this, it might be much simpler to have all categories and tags that are being ‘watched’ appear automatically in the sidebar.

However, I could see this causing some loss of power as there will be categories that folk might like to watch, but never visit unless they get a notification. They would be wasted space on the sidebar. But they could hide these if they are annoying.

See also:

This has come up again for us. Oh, and someone else has asked for the same:

Having all user defaults for this is helpful, but isn’t really sufficient for situations where a category has open access but is only of special interest to a specific group.

If I add them as a default, then it lands in everyone’s sidebar - giving clutter to the majority of users.

If I don’t add them as a default, then the users have to add them manually. And you know how likely that is!!

Is there a way I could apply this via the console? I can’t even find the database table which controls individual user navigation bar preferences.

2 Likes

Here 'tis. Pick a quiet time, backup first (you are doing this at your own risk), and make your way to the Rails console:

./launcher enter app
railsc

Add a category

This will add the category to the sidebar of all group members.

target_group = Group.find_by_name('=CatGroupSlug=')
category = Category.find(=CategoryID=)
users = User.joins(:group_users).where(group_users: { group_id: target_group.id })
users.each do |u|
  SidebarSectionLink.create(user_id: u.id, linkable: category)
end

Add a tag

This will add the specified tag to the sidebar of all group members.

target_group = Group.find_by_name('=TagGroupSlug=')
tag = Tag.find_by_name('=TagSlug=')
users = User.joins(:group_users).where(group_users: { group_id: target_group.id })
users.each do |u|
  SidebarSectionLink.create(user_id: u.id, linkable: tag)
end
2 Likes