# 被暂停的账户导致用户名在自动补全中仍然可见？

**URL:** <https://meta.discourse.org/t/suspended-account-that-leaves-the-username-still-active-in-completions/206298>\
**Category:** Support\
**Created:** [2021年十月18日 01:01 UTC](https://meta.discourse.org/t/suspended-account-that-leaves-the-username-still-active-in-completions/206298 "2021-10-18T01:01:34Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![peternlewis](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/peternlewis/32/108888_2.png) [@peternlewis](https://meta.discourse.org/u/peternlewis)\
**Post date:** [2021年十月18日 01:01 UTC](https://meta.discourse.org/t/suspended-account-that-leaves-the-username-still-active-in-completions/206298/1 "2021-10-18T01:01:34Z")

</div>

相关主题：

[已故社区成员的最佳实践](https://meta.discourse.org/t/best-practices-for-deceased-community-members/146210)

由于出于安全原因我暂停了该已故用户，但这似乎也导致其用户名无法在搜索框中自动补全。

鉴于该用户是我们发帖最活跃的成员，这显然不够理想。

是否有办法在暂停用户的同时，仍使其用户名能够在搜索框及其他地方自动补全？

另外，“已故”应作为暂停用户的原因选项之一。

谢谢。

---

<div class="post-metadata">

**Author:** ![omarfilip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/omarfilip/32/208019_2.png) [@omarfilip](https://meta.discourse.org/u/omarfilip)\
**Post date:** [2021年十月18日 01:25 UTC](https://meta.discourse.org/t/suspended-account-that-leaves-the-username-still-active-in-completions/206298/2 "2021-10-18T01:25:53Z")

</div>

我认为实际上是_已停用_的账户导致用户无法在搜索中出现，而不是因为被停权。尝试停用该用户，但保持其账户处于激活状态。

 ![已激活的用户账户](https://global.discourse-cdn.com/meta/original/3X/4/7/473d285da75cd3fa8de51fb8e2a472b540981deb.png)

停权对话框允许自定义原因：

 ![停权原因](https://global.discourse-cdn.com/meta/original/3X/8/f/8fc1da0542b4beee8ea00daee54e0e20c47b863b.png)

您还可以将用户的电子邮件地址更改为某个随机地址，例如 `suspended123@no-email.invalid`，以防有人尝试重新激活该账户。

---

<div class="post-metadata">

**Author:** ![peternlewis](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/peternlewis/32/108888_2.png) [@peternlewis](https://meta.discourse.org/u/peternlewis)\
**Post date:** [2021年十月18日 02:26 UTC](https://meta.discourse.org/t/suspended-account-that-leaves-the-username-still-active-in-completions/206298/3 "2021-10-18T02:26:15Z")

</div>

> [@omarfilip](#):
>
> 我认为实际上导致用户在搜索中无法出现的，是_已停用_的账户，而不是被暂停的账户。

该账户目前显示为“已激活”。

 ![image](https://global.discourse-cdn.com/meta/original/3X/2/2/22cf5c3c2aca3d0d2f952322a2a3ac99ef050426.png)

> [@omarfilip](#):
>
> 暂停对话框允许设置自定义原因：

是的，我使用了该功能，但“已故”应当是一个有效的默认选项，这样可以自动对账户进行更恰当的处理。

> [@omarfilip](#):
>
> 你还可以将用户的邮箱更改为某个随机地址，例如 `suspended123@no-email.invalid`，以防有人尝试重新激活该账户。

不幸的是，除非邮箱已验证，否则似乎无法进行此更改——至少在我尝试更改时，系统立即提示用户必须响应邮件。因此，这似乎意味着邮箱至少需要在进行更改的这段时间内是有效的。

---

<div class="post-metadata">

**Author:** ![omarfilip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/omarfilip/32/208019_2.png) [@omarfilip](https://meta.discourse.org/u/omarfilip)\
**Post date:** [2021年十月18日 02:53 UTC](https://meta.discourse.org/t/suspended-account-that-leaves-the-username-still-active-in-completions/206298/4 "2021-10-18T02:53:45Z")

</div>

您使用的是最新版本吗？也许 [新的搜索功能](https://meta.discourse.org/t/revert-search-to-old-live-search-pattern/205845?u=omarfilip) 改变了这一行为，但在我的尚未更新到最新版本的 Discourse 中，被暂停并重新激活的用户仍然会显示出来：

 ![Screen Shot 2021-10-17 at 7.41.46 PM](https://global.discourse-cdn.com/meta/original/3X/f/c/fc5506c3d30fcd6714a8e3d2c64798e6a0c9528e.png)

 ![Screen Shot 2021-10-17 at 7.43.02 PM](https://global.discourse-cdn.com/meta/original/3X/4/2/42fba20b925c714b4ca5aa2e9d8a723cfd4c5cb6.png)

我将在明天更新到最新版本，届时会告知您此行为是否发生变化。

---

<div class="post-metadata">

**Author:** ![peternlewis](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/peternlewis/32/108888_2.png) [@peternlewis](https://meta.discourse.org/u/peternlewis)\
**Post date:** [2021年十月18日 07:20 UTC](https://meta.discourse.org/t/suspended-account-that-leaves-the-username-still-active-in-completions/206298/5 "2021-10-18T07:20:36Z")

</div>

> [@omarfilip](#):
>
> 你使用的是最新版本吗？

我使用的是最新的_发布_版本。2.7.8（[18b6f4ecf6](https://github.com/discourse/discourse/commits/18b6f4ecf6d3513af90b8a54a3514dfa160044d8)）。

你是管理员吗？据我所知，行为会根据你是否是管理员（或拥有其他权限）或是普通用户而有所不同。在我的论坛上，管理员用户仍然可以自动补全被暂停用户的名称，但普通用户则不行。

---

<div class="post-metadata">

**Author:** ![omarfilip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/omarfilip/32/208019_2.png) [@omarfilip](https://meta.discourse.org/u/omarfilip)\
**Post date:** [2021年十月18日 18:17 UTC](https://meta.discourse.org/t/suspended-account-that-leaves-the-username-still-active-in-completions/206298/6 "2021-10-18T18:17:44Z")

</div>

是的，我是管理员，但即使以普通用户身份登录，我仍然可以在搜索中自动填充被禁用和已激活的用户。

这发生在 2.8.0.beta6 (d3be77a0d1) 版本上，因此您落后了几个版本。

---

<div class="post-metadata">

**Author:** ![omarfilip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/omarfilip/32/208019_2.png) [@omarfilip](https://meta.discourse.org/u/omarfilip)\
**Post date:** [2021年十月18日 19:08 UTC](https://meta.discourse.org/t/suspended-account-that-leaves-the-username-still-active-in-completions/206298/7 "2021-10-18T19:08:58Z")

</div>

我已更新至最新版本 2.8.0.beta6 (073e5ccd83)，其行为正如您最初描述的那样：当管理员搜索时，用户会自动填充（即使处于已暂停和激活状态），但普通用户搜索时不会自动填充。

---

<div class="post-metadata">

**Author:** ![peternlewis](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/peternlewis/32/108888_2.png) [@peternlewis](https://meta.discourse.org/u/peternlewis)\
**Post date:** [2021年十月19日 02:04 UTC](https://meta.discourse.org/t/suspended-account-that-leaves-the-username-still-active-in-completions/206298/8 "2021-10-19T02:04:39Z")

</div>

那么问题依然存在：是否有一种方法可以在保持用户被禁用的同时，将其纳入自动填充列表中？

显然，该用户必须保持禁用状态，但他也发布了数千条帖子，大家希望能够轻松搜索到他的作品，正如我之前提到的，他是该论坛上发帖最活跃的用户。

---

<div class="post-metadata">

**Author:** ![hello-smile6](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hello-smile6/32/304628_2.png) [@hello-smile6](https://meta.discourse.org/u/hello-smile6)\
**Post date:** [2021年十月19日 02:17 UTC](https://meta.discourse.org/t/suspended-account-that-leaves-the-username-still-active-in-completions/206298/9 "2021-10-19T02:17:08Z")

</div>

为什么不将他们的密码设置为来自 `/dev/random` 的 1 兆字节值？

---

<div class="post-metadata">

**Author:** ![omarfilip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/omarfilip/32/208019_2.png) [@omarfilip](https://meta.discourse.org/u/omarfilip)\
**Post date:** [2021年十月19日 03:59 UTC](https://meta.discourse.org/t/suspended-account-that-leaves-the-username-still-active-in-completions/206298/10 "2021-10-19T03:59:36Z")

</div>

为了保持其未被暂停且处于激活状态，您可以在 Rails 控制台中更改他的电子邮件：

```ruby
rails c
u = User.find_by_email('user@domain.com')
u.email = 'user@no-email.invalid'
u.save!

```

---

<div class="post-metadata">

**Author:** ![peternlewis](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/peternlewis/32/108888_2.png) [@peternlewis](https://meta.discourse.org/u/peternlewis)\
**Post date:** [2021年十月19日 05:21 UTC](https://meta.discourse.org/t/suspended-account-that-leaves-the-username-still-active-in-completions/206298/11 "2021-10-19T05:21:39Z")

</div>

我更倾向于一种不滥用密码和电子邮件地址来试图阻止访问账户的解决方案。账户应被暂停/停用，但同时仍应能在自动补全中使用。

实际上，自动补全应包含已暂停的账户，因为它们的帖子并未被删除且仍可搜索，因此除非账户既被暂停又没有任何帖子，否则我不明白为何要将其排除在外。
