Skip to content

DEV: trigger single event when multiple posts are destroyed at once #32731

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

Merged
merged 2 commits into from
May 15, 2025

Conversation

marstall
Copy link
Contributor

a complement to the :post_destroyed event - customer needed an action to happen just once when the wrench icon was used to delete one or more posts ...

it "triggers DiscourseEvent with :posts_destroyed and correct params" do
sign_in(poster)
# Use spy to monitor DiscourseEvent.trigger
allow(DiscourseEvent).to receive(:trigger).and_call_original
Copy link
Contributor

Choose a reason for hiding this comment

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

We have a nice clean way of tracking events like this ->

events = DiscourseEvent.track_events { PostActionCreator.create(user, post, :inappropriate) }

@marstall marstall merged commit ce2729e into main May 15, 2025
16 checks passed
@marstall marstall deleted the posts-destroyed-event branch May 15, 2025 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants