Post webhook vuurt twee keer af op post_edited voor eerste post in een topic

AI-generated summary

The discussion revolves around a bug where the post webhook fires twice on post_edited for the first post in a topic. Terrapop explains that the first event has no changes in the payload, making it unclear whether the change is valid, while the second event contains the actual changes. This behavior only occurs for the first post, not for subsequent posts or on post_created. Terrapop argues this is confusing and suggests only one event should fire. sam seeks clarification, and vinothkannans confirms the issue and shares a fix in a PR, noting it requires further review due to its impact on topic webhooks. Terrapop appreciates the fix, as it will improve their webhook handling.

First, it fires an event without any changes in the payload (thus the post as it is now) and then a second one with the changes.

This applies only for changes to the first post in a topic.

Expected: Only fire one event, with a payload containing the changed post.

Or is this working as intended? If so, that’s confusing for the receiving endpoint as a change is signaled, but the payload contains no changes at all and you can’t figure out if this is a bogus change event or not (as no info is given in the payload).

It works as intended on post_created and for changes to subsequent posts in a topic, only one event.

Anybody? This drives me crazy working with the post webhook for first posts.

2 likes

I am not sure if this is intentional or not, @vinothkannans do you know ?

1 like

It’s at least confusing for the received endpoint, as there is no single use case for it. Should be one event, not two.

I fixed this issue in below PR. Since it’s changing the way how the topic web hooks are triggered I have to make sure the change again before merging it.

https://github.com/discourse/discourse/pull/10590

3 likes

Awesome, thanks @vinothkannans, our post webhook endpoint will love this :+1:t2:

1 like