A user's too-many-edits flag stops staff from editing a post


(Evaryont 🎆) #1

As a staff member, I should be able to edit a user’s post regardless of the state of their too-many-edits flag, no?

A user in my forum had split up a post into 31 posts, and then tried to edit each one. The forum has the default rate limit of 30 per 24 hour period. He reached out to me to edit the last one post, but I couldn’t edit it as the “too many edits” alert popped up. Shouldn’t my admin power trump that user’s flag? Or not even trigger it, since I’m the one editing the post?


(Jeff Atwood) #2

That does seem like a bug. The user’s rate limit should not apply to the editor unless the editor is the user.


(Tom Shea) #3

Pretty sure I’ve discovered the cause, but I’m having a devil of a time setting up a functional dev environment, so perhaps someone else could run a test?

From post_revisor.rb:

EditRateLimiter.new(@post.user).performed! unless @opts[:bypass_rate_limiter] == true

Should be @user rather than @post.user, since we care about the current user’s edit limit (or staff status) rather than the post’s users edit limit.

On the other hand, this change has some potential downsides when used in conjuction with @lightyear’s Shared Edit plugin because a user could keep creating new users and share edit permission with them to allow for unlimited editing. Perhaps that should be solved elsewhere, though.


(Jeff Atwood) #4

Can we fix this bug this week @eviltrout?


(Kane York) #5

I already noticed this while writing the post ownership change:

https://github.com/riking/discourse/commit/cd855b63003f5a6c3aaa8ab4217ac95f77981b9a
https://github.com/riking/discourse/commit/ccbef858ea83ced043db8a8d37f80a7ef59924fd

part of Change post owner functionality by riking · Pull Request #2203 · discourse/discourse · GitHub


(Sam Saffron) #6