Add ratings data to webhook payloads


Discourse Version: 2.7.0.beta2

Plugin Commit: b02436f

Other Plugins

Steps to Reproduce

Original report: Topic Ratings Plugin - #353 by Arkshine - plugin - Discourse Meta



1 Like

Note: I can’t create feature request (as @fzngagan wanted) – button is disabled for me.


1 Like

No worries :slight_smile:
I think we have disabled new topic creation on that category.

Thanks for submitting! For future reference you can use

The reason topic is creation is disabled is because you do it via the wizard.

I’ll make that clearer in the feature request category :+1:

I think this is a bug anyway? @fzngagan let’s get this fixed by the end of the week. Ping me if you need help.

1 Like

Unlike image , there is no button for feature. Maybe you should add one in the header or fix permission if it actually exists. (Or renaming to “Report”, then you include in the step to choose bug/feature).

1 Like

I’m taking a look at this now.

@angus @Arkshine

The issue here is that discourse uses :post_created and :post_edited events to to trigger webhooks which are the same hooks that we use to add/modify event data. The webhook is being enqueued before the ratings plugin’s code comes into play. Hence the stale data.

The solution here would be to create a new webhook event :rating_post_created which would put the updated payload into the webhook. But then, this webhook can be used only with the ratings plugin topics/posts.

Else, we can contact the discourse team and suggest an improvement to core.

Note: The post_created, post_edited events discussed here are Server Side DiscourseEvent names and not webhook trigger names although they are named similarly here.

Including ratings data in post_created and post_edited makes sense and is convenient.
Before anything else, I would prefer to see if something can be done in the core.

1 Like

I’ve raised it here.

Hey, considering there is no replies, that topic is drown among others, and there is no indication that the staff will take account of this – do you think you could actually create the second solution anyway?

We are probably not going to see any time soon an update and the second solution seems to be easy to implement. Also, it’s kind of problematic for me because the plugin is used in a real-time app.

1 Like

I agree that it may take some time for the team to respond. I’m in favor of adding new webhooks i.e. rating_post_created and rating_post_updated which will bring in the correct data for all the rating type posts. Does that make sense to you as a solution.

Sure. What data are you going to include? I was thinking since this a complementary event, you should include the minimum data, I guess?

1 Like

As an initial idea, I am thinking to include all the post fields. Your app can then use the required fields ?

You could always PR to force the issue … :slight_smile:

1 Like

I’ve no idea how to fix the issue.
It would make no sense to create an (empty?) PR and they won’t like it. :thinking:

From my experience with Discourse, if they don’t answer, they don’t care and you can forget getting any support.

1 Like

No worries. Let’s get the thing in place.

Do you agree to this?

Yes, it’s fine. Initially, I would have said the minimum but the payload size is actually not big. To cover all usage (if other people use them), probably makes sense to include all.

1 Like

Sure. I’ll give an update on this by 2021-02-02T18:30:00Z


I’ve created an experimental branch just to see if it makes it any better. Can you check with this branch.