Require Edit Reason

The purpose of this component is to encourage users to add edit reasons when they edit a post. Edit reasons are displayed at the top of a post’s edit history modal and are a great way to understand why something within a post was changed. This might be especially useful for users that are able to edit other users’ posts as it will help to avoid any “why did you edit my post?!” responses.

How it Works

When someone opens the composer to edit, the edit reason field is exposed and marked required. The save button is disabled until the reason is added.

Once a reason is added, the edit can be saved

Configurable Settings

:star: Pro-tip: If you want to require all users to add edit reasons, simply add the trust_level_0 group to the “edit reason required groups” theme setting.

Installation

Repository Link
https://github.com/discourse/discourse-require-edit-reason

If you are unfamiliar with theme components and how to install them, check out the theme installation guide . And if you’d like to learn more about Discourse themes, take a look at this guide .

37 Likes

I’m not sure if anybody else is experiencing this, but I’ve implemented this on my site and set the edit reason required groups to `trust_level_0’ and it seems like it doesn’t work. I don’t think any other site users are seeing the popup modal asking for an edit reason either.

If anybody else knows a solution, or possibly the theme is broken, please let me know, thanks.

My configuration:

2 Likes

TL 0 cannot edit someone else’s posts. These are default settings in Discourse. I don’t believe this TC overrides the default user TL settings (I may be wrong). See Trust Level Permissions Reference

2 Likes

Shouldn’t it still work if they edit their own post?

5 Likes

I believe so, as how the TL’s work is that as you get promoted, you get added to the next one (e.g. a TL1 user is in the groups TL1 and TL0).

2 Likes

Have you tried creating a test user account?

This would be the best way to test as a regular user of varying Trust levels.

2 Likes

I have tried it on another test account with TL1 and it exhibits the same result. The test user edited a wiki post owned by another user.

2 Likes

Okay this could be related to it being a wiki post vs a standard post. At least guess as a wiki generally makes a post editable by the majority vs a very select few.

2 Likes

I encountered the same problem as you and don’t know how to solve it. Have you resolved your issue? :see_no_evil:

1 Like

Unfortunately no, I have since removed the component from my site altogether.

I’m using, or used or would use, it only for me as an admin, because it is mainly only me who’s editing and I would need for my own purposes reminder to give reasons why I edited. For me that component never worked.

I tried it out and it appears to no longer work — I’ll add the broken tag and take a look when I have a chance

2 Likes

I’ve refactored this component to get it working again, and have made is use more of the native composer behavior rather than relying on a popup

If you’re required to add a reason you’ll see this on edit:

The save button will become active once the edit reason is added:

5 Likes