Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Sep 29, 2024

Conversation

imorland
Copy link
Member

Reported https://discuss.flarum.org/d/32899-flarum-v180-released/83 and following on from #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

  • Has the problem that is being solved here been clearly explained?
  • If applicable, have various options for solving this problem been considered?
  • For core PRs, does this need to be in core, or could it be in an extension?
  • Are we willing to maintain this for years / potentially forever?

Confirmed

  • Frontend changes: tested on a local Flarum installation.
  • Backend changes: tests are green (run composer test).
  • Core developer confirmed locally this works as intended.
  • Tests have been added, or are not appropriate here.

@imorland imorland requested a review from a team as a code owner June 16, 2024 10:51
@imorland
Copy link
Member Author

Ugh, damn StyleCI. See f7c0a3b for my changes here.

luceos
luceos previously requested changes Jun 16, 2024
Copy link
Member

@luceos luceos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please do the reformatting as a direct commit to main/master and then apply the change for the subject as a or?

Thanks.

@luceos luceos dismissed their stale review June 16, 2024 15:55

Did not see the comment about StyleCI, my bad.

Copy link
Member

@luceos luceos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit confused. It seems the abuse prevention @SychO9 implemented with https://github.com/flarum/framework/pull/3890/files#diff-d6304eb2471ddda50b8b56050c4e6ed1f6f0ac4b2511af0de4f363cddeca3bf8 uses the Gate. Why can't we either a) implement another policy ability for avatar removal or b) rename the implemented one to avatar changing. The intention of both PR's seem very similar, yet the implementations are entirely different with one using a Gate and the other Events.

@imorland
Copy link
Member Author

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?

@imorland imorland added this to the 1.8.6 milestone Sep 29, 2024
@imorland imorland merged commit 9038ff6 into 1.x Sep 29, 2024
314 checks passed
@imorland imorland deleted the im/suspended-avatar-delete branch September 29, 2024 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants