# 是否有办法隐藏来自通知 API 的特定通知？

**URL:** https://meta.discourse.org/t/is-there-a-way-to-hide-specific-notifications-from-the-notifications-api/385499
**Category:** Support
**Tags:** notifications
**Created:** [2025 年10 月 14 日 04:01 UTC](https://meta.discourse.org/t/is-there-a-way-to-hide-specific-notifications-from-the-notifications-api/385499 "2025-10-14T04:01:50Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![wings](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wings/32/331381_2.png) [@wings](https://meta.discourse.org/u/wings)
#### Post date: [2025 年10 月 14 日 04:01 UTC](https://meta.discourse.org/t/is-there-a-way-to-hide-specific-notifications-from-the-notifications-api/385499/1 "2025-10-14T04:01:50Z")

</div>

您好，

我想知道是否有一种方法可以禁用特定通知，例如徽章通知或信任级别通知，以便它们不会出现在通知 API 返回的列表中：

```plaintext
{host}/notifications.json?filter=all

```

我的目标是仅检索帖子或聊天通知。

如果 API 不支持此功能，是否有办法阻止 Discourse 在首先将某些通知插入通知列表？

谢谢！

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [2025 年10 月 14 日 08:00 UTC](https://meta.discourse.org/t/is-there-a-way-to-hide-specific-notifications-from-the-notifications-api/385499/2 "2025-10-14T08:00:19Z")

</div>

您正在解决什么问题？您在做什么？为什么不直接忽略您不想要的数据？

---

<div class="post-metadata">

### Author: ![jahan\_gagan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jahan_gagan/32/501948_2.png) [@jahan\_gagan](https://meta.discourse.org/u/jahan_gagan)
#### Post date: [2025 年10 月 14 日 08:26 UTC](https://meta.discourse.org/t/is-there-a-way-to-hide-specific-notifications-from-the-notifications-api/385499/3 "2025-10-14T08:26:06Z")

</div>

无法内置阻止特定类型的通知（例如徽章或信任级别更改）在检索时包含在通知 API 中。最好的解决方法是使用 API 获取所有通知，然后在您的应用程序中按您关心的 `notification_type` 进行过滤。

通知类型代码

> <https://github.com/discourse/discourse/blob/main/app/models/notification.rb#L121-L169>
