# 忽略有关主题更新的通知失败

**URL:** <https://meta.discourse.org/t/dismissing-notifications-about-theme-updates-fails/329504>\
**Category:** Bug\
**Created:** [2024年十月5日 21:41 UTC](https://meta.discourse.org/t/dismissing-notifications-about-theme-updates-fails/329504 "2024-10-05T21:41:14Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![ted](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ted/32/283882_2.png) [@ted](https://meta.discourse.org/u/ted)\
**Post date:** [2024年十月7日 05:15 UTC](https://meta.discourse.org/t/dismissing-notifications-about-theme-updates-fails/329504/5 "2024-10-07T05:15:44Z")

</div>

你好，@Moin！ 👋

感谢你的报告。由于错误消息非常无用，很难确切地说这里发生了什么，但我检查了代码，发现了至少两个可能导致错误的原因：

1. 该通知已被另一位管理员或在另一个标签页中解除。
2. 尝试解除通知的用户不是管理员。（这不可能是上述问题，因为错误不同。）

我今天早上已为这两种情况添加了修复。我会将此主题保持开放一段时间，以查看它是否再次发生。 🙏

* * *

> <https://github.com/discourse/discourse/pull/29099>
>
> \### What is the problem?
> 
> If you have the admin dashboard open, and one of the… admin notices listed has already been dismissed (e.g. in another tab, or by another admin) we would show an ugly "FAILED" modal.
> 
> \<img width="503" alt="Screenshot 2024-10-07 at 12 28 47 PM" src="https://github.com/user-attachments/assets/7f1610f8-cf4d-45d1-8b3d-81c1b4c6426d"\>
> 
> \### How does this fix it?
> 
> Make the admin dismiss endpoint idempotent. If the admin notice is already destroyed, then respond with 200. This will also correctly remove it from the list in the front-end.

> <https://github.com/discourse/discourse/pull/29103>
>
> \### What is the problem?
> 
> Dismissing admin notices is an admin-only action. Th…is is enforced on the back-end both by a routing constraint and a policy in the relevant service.
> 
> However, we still unconditionally display the "Dismiss" button to anyone with access to the admin dashboard. When clicked, it results in a 404 modal (due to the routing constraint.)
> 
> \<img width="419" alt="Screenshot 2024-10-07 at 12 54 13 PM" src="https://github.com/user-attachments/assets/1b497bf9-d067-4ded-b431-fff383f0717a"\>
> 
> \### How does this fix it?
> 
> Only render the dismiss button for admins.

---

_[View the full topic](https://meta.discourse.org/t/dismissing-notifications-about-theme-updates-fails/329504)._
