# 隐藏非管理员的标签信息按钮

**URL:** https://meta.discourse.org/t/hiding-the-tag-info-button-for-non-admins/208294
**Category:** Development
**Created:** [2021年十一月4日 20:26 UTC](https://meta.discourse.org/t/hiding-the-tag-info-button-for-non-admins/208294 "2021-11-04T20:26:23Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![lstuartfry](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lstuartfry/32/236018_2.png) [@lstuartfry](https://meta.discourse.org/u/lstuartfry)
#### Post date: [2021年十一月4日 20:26 UTC](https://meta.discourse.org/t/hiding-the-tag-info-button-for-non-admins/208294/1 "2021-11-04T20:26:23Z")

</div>

大家好，

我想为非管理员用户隐藏“#show-tag-info”按钮。作为管理员，点击此按钮可以更新或删除标签，还可以将标签添加到组中。而非管理员用户点击此按钮时，界面仍会提示用户可以将标签添加到组中。然而，点击该链接后，用户会被重定向到 404 页面。

使用一些 jQuery 代码，可以条件性地为非管理员用户隐藏此按钮。但我想避免这样做，因为这会额外增加一次 API 调用，而我希望避免这种调用。我也可以覆盖该 UI 部分的默认模板，但同样希望避免这样做。

我在 /settings/tags 下没有看到任何与此特定按钮相关的管理员设置。是否有办法为非管理员用户隐藏此按钮，同时避免上述两种可能的解决方案？

谢谢大家！

---

<div class="post-metadata">

### Author: ![renato](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/renato/32/383632_2.png) [@renato](https://meta.discourse.org/u/renato)
#### Post date: [2021年十一月4日 23:41 UTC](https://meta.discourse.org/t/hiding-the-tag-info-button-for-non-admins/208294/2 "2021-11-04T23:41:48Z")

</div>

> [@lstuartfry](#):
>
> 当非管理员点击此按钮时，UI 似乎仍会提示用户可以将标签添加到组中。然而，点击此链接后，用户会被重定向到 404 页面。

我可以在 meta 的 #unsupported-install 上复现此错误，那里有一个指向 `/tag_groups` 的链接，返回 404 错误。

不过，为了避免界面杂乱，我确实在我的社区中为非工作人员用户隐藏了这个按钮：

```css
body:not(.staff) #show-tag-info {
  display: none;
}

```

您不需要

> [@lstuartfry](#):
>
> 为此 UI 部分覆盖默认模板

我可以将此类调整作为主题组件来实现：使用主题组件列表下方的 `➕安装` 按钮，选择“新建”，自定义 CSS，并将其添加到您想要的主题中。

---

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [2021年十一月5日 00:09 UTC](https://meta.discourse.org/t/hiding-the-tag-info-button-for-non-admins/208294/3 "2021-11-05T00:09:24Z")

</div>

是的，我们应该移除该标签组信息，这对普通用户来说确实没有意义。

我认为向所有人显示标签信息的初衷是为了展示该标签是否存在特定的类别限制，以及显示是否存在标签同义词。但也许我们应该隐藏该按钮，除非上述两种情况之一成立。

---

<div class="post-metadata">

### Author: ![jordan.vidrine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jordan.vidrine/32/515563_2.png) [@jordan.vidrine](https://meta.discourse.org/u/jordan.vidrine)
#### Post date: [2023年二月2日 22:35 UTC](https://meta.discourse.org/t/hiding-the-tag-info-button-for-non-admins/208294/6 "2023-02-02T22:35:33Z")

</div>

时隔…一年半才回来 😅

我相信您的问题已在此处解决：

> <https://github.com/discourse/discourse/pull/15177>
>
> This does various things to improve the tag info display. 
> 
> \* General styling …improvements like spacing and tag name size
> \* For normal users, change the wrench icon to an ℹ️ icon
> \* For normal users, hide the text about adding tags to a group
> \* Changed the edit tag name link into a button
> \* Made the "add" button for synonyms a checkmark button that only appears if there's a selection
> \* Gave the description field more space
> 
> Editing before/after (there's a little inconsistency here with the blue/green checkmark buttons... but that's something I can address separately) 
> 
> 
> 
> \<img width="1150" alt="Screen Shot 2021-12-02 at 4 00 31 PM" src="https://user-images.githubusercontent.com/1681963/144502417-bffae518-4ec7-4243-9d2e-3c5d3c5c9ac0.png"\>
> \<img width="1148" alt="Screen Shot 2021-12-02 at 3 55 18 PM" src="https://user-images.githubusercontent.com/1681963/144501994-54d095b0-548f-46c0-9572-b0cb84fd6ca6.png"\>
> 
> Anon before/after
> 
> \<img width="1146" alt="Screen Shot 2021-12-02 at 4 01 02 PM" src="https://user-images.githubusercontent.com/1681963/144502466-9eca9c46-507d-4800-90de-98b38df68eaf.png"\>
> 
> \<img width="1134" alt="Screen Shot 2021-12-02 at 3 42 39 PM" src="https://user-images.githubusercontent.com/1681963/144502497-ce77daf3-088d-400a-8375-5bd35373b429.png"\>

我将关闭此问题 👍

---

<div class="post-metadata">

### Author: ![jordan.vidrine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jordan.vidrine/32/515563_2.png) [@jordan.vidrine](https://meta.discourse.org/u/jordan.vidrine)
#### Post date: [2023年二月2日 22:35 UTC](https://meta.discourse.org/t/hiding-the-tag-info-button-for-non-admins/208294/7 "2023-02-02T22:35:42Z")

</div>


