qpixel
qpixel copied to clipboard
Unify Edit Suggestion and Edit Criteria Checks
General issue for #764, #741, and #301.
All of these issues stem from a disconnect allowing users to suggest edits that they should not be able to (too many tags, tags with spaces, moderator only-tags).
Rather than patching each case individually, there should most likely be some helper function or something that checks that an edit is valid which can be applied to both suggested edits and direct edits going forward, not least so that if any of these criteria change we don't have to update both places.
Agreed. Suggested edits and direct edits should have the same validation checks, so let's do that in one place.
We'll need two checks: is this a valid edit, and does the user have an ability that allows overriding edit rules? The latter is for mod-only tags, but we've at times talked about whether creating new tags should be tied to an ability, so let's not hard-code "isModerator" where we can instead say "hasAbility(moderator)" or whatever.