FEATURE: add reviewable score updated webhook (#12846)

Adds a webhook to notify when a reviewable score is updated.

This is different from created or status changed as additional flags can
roll in and update the score without updating status. Useful for applications
looking to integrate in with Discourse's scores
This commit is contained in:
Jeff Wong
2021-04-26 14:40:32 -10:00
committed by GitHub
parent 22d23c4af1
commit fa393b2956
3 changed files with 24 additions and 2 deletions

View File

@ -494,6 +494,17 @@ describe WebHook do
payload = JSON.parse(job_args["payload"])
expect(payload["id"]).to eq(reviewable.id)
reviewable.add_score(
Discourse.system_user,
ReviewableScore.types[:off_topic],
reason: "test"
)
job_args = Jobs::EmitWebHookEvent.jobs.last["args"].first
expect(job_args["event_name"]).to eq("reviewable_score_updated")
payload = JSON.parse(job_args["payload"])
expect(payload["id"]).to eq(reviewable.id)
reviewable.perform(Discourse.system_user, :reject_user_delete)
job_args = Jobs::EmitWebHookEvent.jobs.last["args"].first