Forgotten new permissions in the category security tab

AI-generated summary

The discussion revolves around adding a feature to prevent users from losing unsaved changes when modifying category permissions. Falco proposes a prompt to remind users of pending changes before they can save or exit the page. awesomerobot suggests that clicking the “add” button should automatically save the changes, but jomaxro argues that the extra step of clicking “save” is necessary to prevent accidental permission grants.

eviltrout notes that the “Save Category” button currently applies to all tabs/sections, so the warning should be triggered if any changes are made. Later, eviltrout assigns the task to Osama, who creates a pull request (https://github.com/discourse/discourse/pull/7947) to implement the feature. The proposed solution includes a warning prompt that appears when the user tries to save without clicking the “plus” button, which has been updated to a primary color to make it more noticeable.

Continuing the discussion from Auto-add permissions/unsaved permissions prompt:

I think we need to go a bit further in this.

If you have a pending change (1) and click on save we should stop you and say that you have pending changes to apply, in a “Are you sure” thing.

6 Likes

should we even need to click save? I feel like clicking the add button should be enough?

3 Likes

I like save. It’s an extra step to ensure the permissions are correct. Without it, if I select the wrong group in the dropdown and click the :heavy_plus_sign:, they get access immediately, without an opportunity for me to fix it.

3 Likes

One thing that makes this slightly more complicated is the “Save Category” button applies to content on all tabs/pills right now. The warning should probably apply if you’ve made changes to ANYTHING on any section if you hit the X.

6 Likes

Hey @Osama can you take this one? It should be pretty straightforward but let us know if you encounter any issues.

4 Likes

PR for this:

https://github.com/discourse/discourse/pull/7947

Screenshot:

The save category button will trigger the warning if the user changes one of the dropdowns and doesn’t click the plus button. They can click save again and it will ignore the pending change and save anyway. Clicking the plus button will reset the trigger, so if they don’t change the dropdowns after clicking the plus button, the warning won’t be triggered.

Also I changed the plus button color to primary so it stands out a bit more.

Does this sound OK?

7 Likes