FIX: prevent duplicate `post_edited` webhooks on first post edit. (PR #10590)

GitHub

This pull request has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/post-webhook-fires-two-times-on-post-edited-for-first-post-in-a-topic/162408/5

I recently added https://github.com/discourse/discourse/blob/master/spec/support/sidekiq_helpers.rb so we don’t have to manually fetch the job_args anymore.

Not related but let us change this to use the sidekiq helpers too :slight_smile:

We can’t change the arguments for triggers like this without having to go through a depreciation cycle since plugins might be using these triggers.

How long does a “depreciation cycle” take?

I’m unable to use the new helper method in this case since it’s testing nested hash arguments.

I didn’t add depreciation. I reincluded that argument for now.

Nice catch!

I think this assertion doesn’t fully cover what the description requires which is to ensure that only the topic_edited event job is enqueued. We need to test for a count or assert thta the post_edited event is not fired.

Is this test a duplicate of https://github.com/discourse/discourse/pull/10590/files#diff-0fae1daa2e2270483f864ea4a3e859f7R1235 ?