mirror of
https://github.com/discourse/discourse.git
synced 2025-02-22 08:12:01 +08:00

* FIX: Only modify secured sidebar links on user promotion/demotion If a user is created populate their sidebar with the default categories/tags that they have access to. If a user is promoted to admin populate any new categories/tags that they now have access to. If an admin is demoted remove any categories/tags that they no longer have access to. This will only apply for "secured" categories. For example if these are the default sitebar categories: - general - site feedback - staff and a user only has these sidebar categories: - general when they are promoted to admin they will only receive the "staff" category. As this is a default category they didn't previously have access to. * Add spec, remove tag logic on update Change it so that if a user becomes unstaged it used the "add" method instead of the "update" method because it is essentially following the on_create path. On admin promotion/demotion remove the logic for updating sidebar tags because we don't currently have the tag equivalent like we do for User.secure_categories. Added the test case for when a user is promoted to admin it should receive *only* the new sidebar categories they didn't previously have access to. Same for admin demotion. * Add spec for suppress_secured_categories_from_admin site setting * Update tags as well on admin promotion/demotion * only update tags when they are enabled * Use new SidebarSectionLinkUpdater We now have a SidebarSectionLinkUpdater that was introduced in: fb2507c6ce80a1f4fc3a68a23342e5eca765a13f * remove empty line