# 提供显示聊天中全名的选项

**URL:** <https://meta.discourse.org/t/provide-option-to-choose-showing-full-names-in-chat/269487>\
**Category:** Feature\
**Tags:** chat, completed\
**Created:** [2023年六月24日 03:52 UTC](https://meta.discourse.org/t/provide-option-to-choose-showing-full-names-in-chat/269487 "2023-06-24T03:52:20Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![jordan-violet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jordan-violet/32/281428_2.png) [@jordan-violet](https://meta.discourse.org/u/jordan-violet)\
**Post date:** [2023年六月24日 03:52 UTC](https://meta.discourse.org/t/provide-option-to-choose-showing-full-names-in-chat/269487/1 "2023-06-24T03:52:20Z")

</div>

对于像我们这样需要全名的社区，如果能在聊天框、最近的私人聊天列表等地方看到真实姓名而不是用户名，那将是非常好的。

---

<div class="post-metadata">

**Author:** ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)\
**Post date:** [2023年六月24日 15:51 UTC](https://meta.discourse.org/t/provide-option-to-choose-showing-full-names-in-chat/269487/2 "2023-06-24T15:51:48Z")

</div>

在管理员 - 设置中，您需要启用（选中）`enable_names` 和 `display_name_on_posts`，然后确保禁用（取消选中）`prioritize_username_in_ux`。请注意，这也会在帖子、用户卡片和个人资料中显示他们的全名。您可以在 Meta 聊天中看到这一点，其中显示了全名 🙂

如果您只想在聊天中显示，我相信一些 CSS 可以隐藏其他地方的全名。

---

<div class="post-metadata">

**Author:** ![jordan-violet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jordan-violet/32/281428_2.png) [@jordan-violet](https://meta.discourse.org/u/jordan-violet)\
**Post date:** [2023年六月24日 17:05 UTC](https://meta.discourse.org/t/provide-option-to-choose-showing-full-names-in-chat/269487/3 "2023-06-24T17:05:34Z")

</div>

> [@Lilly](#):
>
> 在 admin - settings 中，您需要启用（勾选）`enable_names` 和 `display_name_on_posts`，然后确保 `prioritize_username_in_ux` 被禁用（未勾选）。请注意，这也会在帖子、用户卡片和个人资料中显示他们的全名。您可以在 Meta 聊天中看到这一点，其中显示了全名 🙂

以上所有设置都已完成（已仔细检查以确保），但聊天仍然显示用户名而不是全名：

 ![image](https://global.discourse-cdn.com/meta/original/4X/0/0/a/00af0ec4e748bc4f5a659bee7c3c3210de13550e.png)

我想知道这是否与我们从 Discourse 获得的自定义主题有关。

---

<div class="post-metadata">

**Author:** ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)\
**Post date:** [2023年六月24日 17:15 UTC](https://meta.discourse.org/t/provide-option-to-choose-showing-full-names-in-chat/269487/4 "2023-06-24T17:15:57Z")

</div>

尝试安全模式。我在我的网站上设置了上述所有设置进行测试，并且它像在这里的元上一样运行。 🤔

---

<div class="post-metadata">

**Author:** ![jordan-violet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jordan-violet/32/281428_2.png) [@jordan-violet](https://meta.discourse.org/u/jordan-violet)\
**Post date:** [2023年六月24日 17:16 UTC](https://meta.discourse.org/t/provide-option-to-choose-showing-full-names-in-chat/269487/5 "2023-06-24T17:16:56Z")

</div>

> [@Lilly](#):
>
> 就像在这里的元上一样。

有趣的是，我看到我们的聊天显示的是用户名而不是全名：

 ![image](https://global.discourse-cdn.com/meta/original/4X/8/b/0/8b02acf99e7bd9617e61b12e6e4969ea0c7406b5.png)

---

<div class="post-metadata">

**Author:** ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)\
**Post date:** [2023年六月24日 17:19 UTC](https://meta.discourse.org/t/provide-option-to-choose-showing-full-names-in-chat/269487/6 "2023-06-24T17:19:55Z")

</div>

这很奇怪。我的窗口和聊天对话中也显示了用户名和姓名 🤔 我也看不到可以覆盖它的用户偏好设置……

---

<div class="post-metadata">

**Author:** ![jordan-violet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jordan-violet/32/281428_2.png) [@jordan-violet](https://meta.discourse.org/u/jordan-violet)\
**Post date:** [2023年六月24日 17:20 UTC](https://meta.discourse.org/t/provide-option-to-choose-showing-full-names-in-chat/269487/7 "2023-06-24T17:20:03Z")

</div>

> [@Lilly](#):
>
> 尝试 [安全模式](https://meta.discourse.org/t/how-to-use-discourse-safe-mode/53504)

另外奇怪的是，安全模式下聊天没有显示为启用（也无法启用）。

---

<div class="post-metadata">

**Author:** ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)\
**Post date:** [2023年六月24日 17:20 UTC](https://meta.discourse.org/t/provide-option-to-choose-showing-full-names-in-chat/269487/8 "2023-06-24T17:20:28Z")

</div>

哦，是的，因为它是插件 🤦‍♀️ 哈哈，真是的

---

<div class="post-metadata">

**Author:** ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)\
**Post date:** [2023年六月24日 17:29 UTC](https://meta.discourse.org/t/provide-option-to-choose-showing-full-names-in-chat/269487/9 "2023-06-24T17:29:18Z")

</div>

总之，供您参考，我的 Meta 聊天模态框看起来是这样的。我的名字和用户名也会显示在聊天中。这看起来是团队需要处理的任务 🙂

 ![chat_test_usernames](https://global.discourse-cdn.com/meta/original/4X/2/2/3/2232f19fe27a72e12fe738b2a507b445943fef6d.png)

---

<div class="post-metadata">

**Author:** ![jordan-violet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jordan-violet/32/281428_2.png) [@jordan-violet](https://meta.discourse.org/u/jordan-violet)\
**Post date:** [2023年六月24日 17:31 UTC](https://meta.discourse.org/t/provide-option-to-choose-showing-full-names-in-chat/269487/10 "2023-06-24T17:31:08Z")

</div>

当你点击左上角的返回箭头时，能显示一张截图吗？那个窗口看起来是什么样的？

---

<div class="post-metadata">

**Author:** ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)\
**Post date:** [2023年六月24日 17:36 UTC](https://meta.discourse.org/t/provide-option-to-choose-showing-full-names-in-chat/269487/11 "2023-06-24T17:36:56Z")

</div>

哦，嘿，我们开始了——全名在哪里？ 🤔

 ![chat_test_usernames_2](https://global.discourse-cdn.com/meta/original/4X/e/9/3/e934858b93178b135be794051e6c37ea56b0fd7c.png)

---

<div class="post-metadata">

**Author:** ![jordan-violet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jordan-violet/32/281428_2.png) [@jordan-violet](https://meta.discourse.org/u/jordan-violet)\
**Post date:** [2023年六月24日 17:37 UTC](https://meta.discourse.org/t/provide-option-to-choose-showing-full-names-in-chat/269487/12 "2023-06-24T17:37:28Z")

</div>

无处可寻！

---

<div class="post-metadata">

**Author:** ![davidb](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/davidb/32/554671_2.png) [@davidb](https://meta.discourse.org/u/davidb)\
**Post date:** [2024年九月17日 06:53 UTC](https://meta.discourse.org/t/provide-option-to-choose-showing-full-names-in-chat/269487/14 "2024-09-17T06:53:24Z")

</div>

此功能现已添加：

> <https://github.com/discourse/discourse/pull/28843>
>
> This change adds full names to direct message channel titles when the following …conditions are met:
> 
> \- SiteSetting.enable\_names = true
> \- SiteSetting.display\_name\_on\_posts = true
> \- SiteSetting.prioritize\_username\_in\_ux = false
> 
> If a user's full name is blank, it will fallback to their username in both 1-1 channels and Group DM channels.
> 
> \### How it looks
> 
> Example where we fallback to username for the user \`@wilbur\` due to missing full name:
> 
> \<img width="396" alt="Screenshot 2024-09-16 at 5 01 30 PM" src="https://github.com/user-attachments/assets/f0d27a21-d96f-4f8a-bec5-7aa858f6d8b7"\>

请注意，对于个人资料中没有姓名的用户，将恢复使用其用户名。

要使此功能生效，需要具备此处概述的相同设置：

> [@Lilly](#):
>
> 在管理员 - 设置中，您需要启用 `enable_names` 和 `display_name_on_posts`（勾选），然后确保 `prioritize_username_in_ux` 被禁用（不勾选）。

---

<div class="post-metadata">

**Author:** ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)\
**Post date:** [2024年九月17日 18:08 UTC](https://meta.discourse.org/t/provide-option-to-choose-showing-full-names-in-chat/269487/15 "2024-09-17T18:08:40Z")

</div>

是否可以隐藏用户名前面的“@”符号？由于 `enable_names` 已禁用，因此我不需要它来突出显示这是一个用户名，而在所有其他地方，用户名也不以“@”开头。

---

<div class="post-metadata">

**Author:** ![davidb](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/davidb/32/554671_2.png) [@davidb](https://meta.discourse.org/u/davidb)\
**Post date:** [2024年十月3日 08:48 UTC](https://meta.discourse.org/t/provide-option-to-choose-showing-full-names-in-chat/269487/16 "2024-10-03T08:48:03Z")

</div>

你发现得很好，我们内部已经讨论过这个问题，在直接消息频道中删除用户名的别名是有意义的。通常，我们只在提及另一位用户时使用别名，因此在频道标题中没有必要保留它。

已通过此提交进行更新：

> <https://github.com/discourse/discourse/commit/4bfe78d1e66fab345dda56f791e59c749d0de3a6>
>
> Makes usernames in Chat Direct Message channels consistent with other areas of t…he app by removing the alias.

---

<div class="post-metadata">

**Author:** ![davidb](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/davidb/32/554671_2.png) [@davidb](https://meta.discourse.org/u/davidb)\
**Post date:** [2024年十月6日 12:54 UTC](https://meta.discourse.org/t/provide-option-to-choose-showing-full-names-in-chat/269487/17 "2024-10-06T12:54:32Z")

</div>

此主题已在 3 天后自动关闭。不再允许回复。
