草稿备份帖子触发 post_created webhook

自动创建的草稿备份帖子是否会触发 post_createdpost_edited 网页钩子事件,这是故意的吗?

这是我看到的载荷示例。请注意,我正在开发站点上测试此功能。可能是我配置有误。

草稿帖子 post_created 载荷
// Headers
Request URL: http://localhost:5173/api/discoursePostEvent
Request method: POST
Accept: */*
Connection: close
Content-Length: 1366
Content-Type: application/json
Host: localhost
User-Agent: Discourse/3.3.0.beta2-dev
X-Discourse-Instance: http://127.0.0.1:4200
X-Discourse-Event-Id: 3001
X-Discourse-Event-Type: post
X-Discourse-Event: post_created
X-Discourse-Event-Signature: sha256=ba23c86e4f40cc1c05442796227a53eb34a3498750447eeb5ce4e8e9f85ca13a

// Payload
{
  "post": {
    "id": 1070,
    "username": "scossar",
    "avatar_template": "/user_avatar/127.0.0.1/scossar/{size}/57_2.png",
    "created_at": "2024-05-21T17:48:15.497Z",
    "cooked": "<pre><code class=\"lang-plaintext\">Triggering the post event webhook.\n</code></pre>\n<pre><code class=\"lang-plaintext\">seq: 0\nkey: topic_536\n</code></pre>",
    "post_number": 18,
    "post_type": 1,
    "updated_at": "2024-05-21T17:48:15.497Z",
    "reply_count": 0,
    "reply_to_post_number": null,
    "quote_count": 0,
    "incoming_link_count": 0,
    "reads": 0,
    "score": 0,
    "topic_id": 474,
    "topic_slug": "backup-drafts-from-ongoing-topics",
    "topic_title": "Backup Drafts from ongoing topics",
    "category_id": null,
    "primary_group_name": null,
    "flair_name": null,
    "flair_group_id": null,
    "version": 1,
    "user_title": null,
    "bookmarked": false,
    "raw": "    Triggering the post event webhook.\n\n```text\nseq: 0\nkey: topic_536\n```",
    "moderator": false,
    "admin": true,
    "staff": true,
    "user_id": 7,
    "hidden": false,
    "trust_level": 1,
    "deleted_at": null,
    "user_deleted": false,
    "edit_reason": null,
    "wiki": false,
    "reviewable_id": null,
    "reviewable_score_count": 0,
    "reviewable_score_pending_count": 0,
    "event": null,
    "reactions": [],
    "current_user_reaction": null,
    "reaction_users_count": 0,
    "current_user_used_main_reaction": false,
    "can_accept_answer": true,
    "can_unaccept_answer": false,
    "accepted_answer": false,
    "topic_accepted_answer": false,
    "topic_posts_count": 18,
    "topic_filtered_posts_count": 18,
    "topic_archetype": "private_message"
  }
}

可以在网页钩子接收代码中过滤掉这些请求,但它们对于大多数用例来说似乎是不必要的。

稍微相关的是,如果可能的话,最好将主题和帖子事件网页钩子限制为常规主题。

对于我这种情况,我希望接收与常规主题相关的所有事件的网页钩子,并且不希望接收私人消息的网页钩子,我认为解决这两个问题的办法是将站点上的所有类别添加到“触发类别”输入中。

1 个赞