mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 05:16:00 +08:00
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:
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user