I have a webhook handling post events, but if I delete a post, there is nothing that indicates deletion. I expected one of these fields to tell me it was deleted:
post {
u'deleted_at': None,
u'hidden': False,
u'user_deleted': False,
...
}
1 个赞
justin
(Justin DiRose)
2019 年6 月 28 日 18:55
4
是的,我可以。
我刚刚在自己的一个站点上删除了锁定分类中的一条帖子。系统生成了 webhook,但负载(payload)中并未表明帖子已被删除,仅体现在请求头中。
请求头:
Request URL: xxxxxxx
Request method: POST
Accept: */*
Connection: close
Content-Length: 880
Content-Type: application/json
Host: hooks.zapier.com
User-Agent: Discourse/2.4.0.beta1
X-Discourse-Instance: xxxxxxx
X-Discourse-Event-Id: 6334
X-Discourse-Event-Type: post
X-Discourse-Event: post_destroyed
负载:
{
"post": {
"id": 11702,
"name": "Justin DiRose",
"username": "justindirose",
"avatar_template": "/user_avatar/xxxxxxxx/justindirose/{size}/1795_2.png",
"created_at": "2019-06-28T18:50:55.078Z",
"cooked": "<p>这里是一条新帖子。仅用于测试。</p>",
"post_number": 2,
"post_type": 1,
"updated_at": "2019-06-28T18:50:55.078Z",
"reply_count": 0,
"reply_to_post_number": null,
"quote_count": 0,
"incoming_link_count": 0,
"reads": 1,
"score": 0,
"topic_id": 5184,
"topic_slug": "test-webhook-topic",
"topic_title": "测试 Webhook 主题",
"display_username": "Justin DiRose",
"primary_group_name": "",
"version": 1,
"user_title": "",
"moderator": true,
"admin": true,
"staff": true,
"user_id": xxx,
"hidden": false,
"trust_level": 4,
"deleted_at": null,
"user_deleted": false,
"edit_reason": null,
"wiki": false,
"reviewable_id": null,
"reviewable_score_count": 0,
"reviewable_score_pending_count": 0,
"topic_posts_count": 2
}
}
6 个赞
Falco
(Falco)
2019 年6 月 28 日 21:18
5
我认为这是按设计运行的:由于该操作可能具有破坏性,Webhook 会在操作发生之前 发送对象的快照,并将 Webhook 的原因包含在请求头中。
5 个赞