flarum / framework

Simple forum software for building great communities.
http://flarum.org/
6.39k stars 834 forks source link

[suspend][core] [1.x] fix: suspended users can remove avatar #3998

Closed imorland closed 2 months ago

imorland commented 5 months ago

Reported https://discuss.flarum.org/d/32899-flarum-v180-released/83 and following on from https://github.com/flarum/framework/pull/3890

Changes proposed in this pull request: Dispatch AvatarDeleting before beginning the avatar deletion process, add a listener to flarum/suspend to prevent a suspended user from removing their avatar. Admins and other users with permission may still remove the avatar of the suspended user if required.

New tests for this scenario are included. Happy to make the same change against the 2.x branch if required, please let me know.

Reviewers should focus on:

Screenshot

QA

Necessity

Confirmed

imorland commented 5 months ago

Ugh, damn StyleCI. See https://github.com/flarum/framework/pull/3998/commits/f7c0a3b7e95c1fecae9c1fcfae39fedd0149c3b0 for my changes here.

imorland commented 5 months ago

I agree that what you're saying would make sense for 2.x, but I feel that if that was implemented in 1.x we run the risk of introducing a breaking change by adding a removeAvatar gate.

How would we feel about the change proposed here for 1.x as a "quick fix/patchup", and a solution based on a gate for 2.x?