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

[flags] complications with deleting event #68

Open
luceos opened this issue Jul 13, 2021 · 1 comment
Open

[flags] complications with deleting event #68

luceos opened this issue Jul 13, 2021 · 1 comment

Comments

@luceos
Copy link
Member

luceos commented Jul 13, 2021

The Deleting event in the flarum/flags extension was refactored here flarum/flags#35.

As a consequence:

  • We cannot listen to the Deleting event and send anything back to the user because the flags for the post haven't been actually deleted yet.
  • We cannot use the afterDelete callback from the AbstractModel because deletion is executed from the eloquent relationship, which uses an underlying query Builder object which doesn't fire events.

In addition, the original comment made by Ian (flarum/flags#35 (comment)) - to me - isn't really, entirely valid. Our flags implementation dismisses all flags from a post when the flag(s) on that post are reviewed; it is one interaction that causes the dismissal of all flags of one post.

As such we need to remedy this by doing:

  • Reinstate or move logic from FlagsWillBeDeleted to Deleting.
  • Or fire a FlagsHaveBeenDeleted event.
  • Use the post as argument in the event, not the flags (which are deleted).
@askvortsov1
Copy link
Member

I like:

  • Using the post as the argument
  • Adding a Deleted event in addition to Deleting

@askvortsov1 askvortsov1 transferred this issue from flarum/framework Mar 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants