# 用户名按字母顺序排序

**URL:** <https://meta.discourse.org/t/alphabetic-sort-of-usernames/140561>\
**Category:** Feature\
**Created:** [2020年二月4日 09:44 UTC](https://meta.discourse.org/t/alphabetic-sort-of-usernames/140561 "2020-02-04T09:44:56Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![mentalstring](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mentalstring/32/168934_2.png) [@mentalstring](https://meta.discourse.org/u/mentalstring)\
**Post date:** [2020年二月4日 09:44 UTC](https://meta.discourse.org/t/alphabetic-sort-of-usernames/140561/1 "2020-02-04T09:44:56Z")

</div>

这是由我们的一位成员提出的，看起来很有道理。

目前，“用户”部分可以按许多条件进行排序（从访问量、查看次数到回复数等），但缺少我认为很重要的一项：按用户名排序。目前无法按用户名（字母顺序）对用户列表进行排序。

同样，使用常规搜索并使用“@”前缀进行过滤会返回现有用户名的列表，但该列表也不是按字母顺序排列的——我猜它显示的是最活跃的用户。对此我其实表示赞同，但这样一来，似乎在任何地方都无法获得按字母顺序排列的用户名列表。

因此，这是一个功能请求：能否将“用户”部分表格中的用户名也作为排序条件？我设想将“用户名”列标题变为可排序的“用户名”，并将结果数量移至上方，或许放在时间范围过滤器旁边，或者放在搜索框旁边。

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [2020年二月5日 00:34 UTC](https://meta.discourse.org/t/alphabetic-sort-of-usernames/140561/2 "2020-02-05T00:34:30Z")

</div>

我同意，在论坛达到一定规模后，在此处增加按用户名和姓名排序的选项是有意义的。

要实现良好的用户体验并不容易，欢迎随时提供视觉设计稿，以便我们进行评估。

---

<div class="post-metadata">

**Author:** ![mentalstring](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mentalstring/32/168934_2.png) [@mentalstring](https://meta.discourse.org/u/mentalstring)\
**Post date:** [2020年二月6日 09:42 UTC](https://meta.discourse.org/t/alphabetic-sort-of-usernames/140561/3 "2020-02-06T09:42:08Z")

</div>

这是一个简单的草图，仅用于帮助可视化：

 ![usermockup](https://global.discourse-cdn.com/meta/original/3X/6/a/6a30cfa10ad7cba80ceff1a8d43f8461000b14d2.jpeg)

`用户名` 标题的对齐方式遵循 Discourse 中其他用户表格的做法，例如管理员用户列表（在那里已经可以按用户名排序，但这是针对用户的）。

唯一的另一个改动是将结果数量移至过滤框的左侧，我认为这样比现在更容易找到。

在小视口下这应该不是问题，因为表格列的宽度已经大于顶部过滤控件所需的大小。

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [2020年二月7日 01:32 UTC](https://meta.discourse.org/t/alphabetic-sort-of-usernames/140561/4 "2020-02-07T01:32:27Z")

</div>

我并不反对添加这个，我想知道 @codinghorror 是怎么想的。

此外，如果 `prioritize username in ux` 未勾选，那么该标题应该是“姓名”而不是“用户名”，筛选条件也应该是“按姓名筛选”而不是“按用户名筛选”。

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [2020年二月7日 03:28 UTC](https://meta.discourse.org/t/alphabetic-sort-of-usernames/140561/5 "2020-02-07T03:28:15Z")

</div>

我没看出原型和用户页面当前的表现之间有什么差异？

在我们推进之前，我至少需要看到一位企业客户提出这项需求。

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [2020年二月7日 04:06 UTC](https://meta.discourse.org/t/alphabetic-sort-of-usernames/140561/6 "2020-02-07T04:06:00Z")

</div>

目前的区别在于，你无法点击“Users XYZ”列按用户名/用户排序：

 ![image](https://global.discourse-cdn.com/meta/original/3X/5/9/59aa672f9e96cc4e360048f72754ec724e6f2cc9.png)

这倒也无妨，这件事可以暂缓。我一点也不着急，完全可以等一等。

说实话，只有在拥有数百名用户都叫“Jane”的超大型社区中，你才会真正需要这个功能。

鉴于我们目前尚未获得正式批准（而且该提案还移除了一个功能——用户总数），我暂时不会添加 #pr-welcome 标签。

---

<div class="post-metadata">

**Author:** ![mentalstring](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mentalstring/32/168934_2.png) [@mentalstring](https://meta.discourse.org/u/mentalstring)\
**Post date:** [2020年二月7日 14:35 UTC](https://meta.discourse.org/t/alphabetic-sort-of-usernames/140561/7 "2020-02-07T14:35:29Z")

</div>

> [@codinghorror](#):
>
> 我没看出原型图和当前用户页面显示的效果有什么区别？

第一列的表头将变为“用户名”（或根据设置显示为“姓名”），结果数量将移至搜索框旁边。下方是改进后的原型图。

> [@sam](#):
>
> 鉴于我们实际上并未获得批准（而且该提案还移除了一个功能——用户总数）

该提案并未移除任何功能：用户总数仍然存在，只是移到了筛选框左侧，这样在搜索时更容易找到：

 ![usermockup](https://global.discourse-cdn.com/meta/original/3X/2/0/2093c1f3633825fa3d36abb7a7958f8fab5f5306.jpeg)

当前状态，仅便于对比：

 ![Screen Shot 2020-02-07 at 14.32.22](https://global.discourse-cdn.com/meta/original/3X/0/4/04c50e5048ed283285e5ec9461251cffa0e9a464.png)

---

<div class="post-metadata">

**Author:** ![mentalstring](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mentalstring/32/168934_2.png) [@mentalstring](https://meta.discourse.org/u/mentalstring)\
**Post date:** [2020年二月16日 09:18 UTC](https://meta.discourse.org/t/alphabetic-sort-of-usernames/140561/9 "2020-02-16T09:18:52Z")

</div>

能否请您再次查看一下？我知道这不是高优先级事项，但我认为这可能因对提议内容的误解而被驳回。这不会移除任何功能。详情请见我的上一贴。谢谢。

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [2020年二月16日 09:25 UTC](https://meta.discourse.org/t/alphabetic-sort-of-usernames/140561/10 "2020-02-16T09:25:58Z")

</div>

好的，我会在你的设计稿上添加 #pr-welcome 标签。如果社区有人能兼顾移动端适配并确保索引正确，我们就可以推进这项工作。

---

<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:** [2020年八月26日 14:20 UTC](https://meta.discourse.org/t/alphabetic-sort-of-usernames/140561/11 "2020-08-26T14:20:42Z")

</div>

此 PR 已合并到 master 分支

> <https://github.com/discourse/discourse/pull/10482>
>
> Added a PR for this
> https://meta.discourse.org/t/alphabetic-sort-of-usernames/1…40561

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [2020年八月31日 02:25 UTC](https://meta.discourse.org/t/alphabetic-sort-of-usernames/140561/12 "2020-08-31T02:25:27Z")

</div>


