mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Generate webhook payloads before destroy events (#6325)
This commit is contained in:
committed by
Guo Xiang Tan
parent
5b630f3188
commit
8430ea927e
@@ -424,6 +424,16 @@ describe PostDestroyer do
|
||||
}.to_not change { author.topic_count }
|
||||
expect(author.post_count).to eq(0) # also unchanged
|
||||
end
|
||||
|
||||
it 'triggers the extensibility events' do
|
||||
events = DiscourseEvent.track_events { PostDestroyer.new(admin, first_post).destroy }.last(2)
|
||||
|
||||
expect(events[0][:event_name]).to eq(:post_destroyed)
|
||||
expect(events[0][:params].first).to eq(first_post)
|
||||
|
||||
expect(events[1][:event_name]).to eq(:topic_destroyed)
|
||||
expect(events[1][:params].first).to eq(first_post.topic)
|
||||
end
|
||||
end
|
||||
|
||||
context 'deleting the second post in a topic' do
|
||||
@@ -502,6 +512,13 @@ describe PostDestroyer do
|
||||
it "creates a new user history entry" do
|
||||
expect { subject }.to change { UserHistory.count }.by(1)
|
||||
end
|
||||
|
||||
it 'triggers a extensibility event' do
|
||||
events = DiscourseEvent.track_events { subject }
|
||||
|
||||
expect(events[0][:event_name]).to eq(:post_destroyed)
|
||||
expect(events[0][:params].first).to eq(post)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user