自动组的可见性如何工作?

I’m a bit confused as to how the visibility of automatic groups works. At this point, I am just talking about the /groups directory.
Here is what I am seeing in a pretty fresh install of 2.7.0.beta4:

  • If an user with admin or moderator bits looks at /groups, they see all 8 automatic groups (admins, moderators, staff, trust_level_[0-4]).
  • If a non-admin, non-moderator user (no matter the trust_level) looks at /groups, they see only the moderators group.

But, all of these groups have the same, default Visibility settings:

  • Who can see this group? Logged on users
  • Who can see this group’s members? Everyone

Is this how it is supposed to work? Or is there something wrong with the handling of the Visibility parameters for these groups?

5 个赞

There is a comment in the code that explains what is going on: “hide automatic groups from all non stuff to de-clutter page.” That happens here: discourse/app/controllers/groups_controller.rb at main · discourse/discourse · GitHub.

What the code is doing is overriding the group visibility settings for automatic groups when the groups page is viewed by a non-staff users. Only the moderators group will be displayed.

Unrelated to the issue, but when I tried to onebox the Github link that I posted above, the code was displayed in the onebox without any formatting in the preview:

3 个赞

嗯,这确实解释了原因。我相信这段代码是出于好意编写的,但它是错误的,因为:

  1. 我可能希望其他自动群组(除版主外)可见。
  2. 自动群组的管理界面允许我设置非版主自动群组的可见性,但此设置被忽略了。

删除这块代码(以及那个已经存在了 6 年的可爱拼写错误)应该很容易。

棘手的问题是,如果有人认为有必要,可以将自动群组的当前可见性设置更改为“群组所有者”,这样这些群组就不会意外地出现在所有习惯于它们被强制设为不可见的安装中。我不知道 Discourse 是否有某种机制可以在升级期间进行此类更改——但这是在进行架构更改时需要做的事情,所以肯定有办法。

另外:这种“尽管有可见性设置,但我们就是要把自动组隐藏在组目录中”的行为很糟糕,因为它掩盖了 visibility_level 中仍然有意义的其他方面。例如:

  • 管理员 X 尝试了可见性设置,并意识到无论如何非员工用户都无法在组目录中看到 trust_level_0
  • 因此……管理员 X 将 visibility_levelmember_visibility_level 设置为“所有人”,因为这些设置似乎没有任何效果。
  • 匿名用户 Z 浏览到 /groups/trust_level_0 并获取了网站上所有用户的列表。

也许管理员 X 在乎,也许不在乎,但无论如何,管理员 X 会对成为可能感到惊讶。

我之前不知道的无关有趣的知识

meta.discourse 用户按信任级别分布:

级别 用户数
TL0 45,942
TL1 29,226
TL2 3,620
TL3 124
TL4 102

你好 mdoggydog :slight_smile:

有些观点对我来说是有效的,例如:

这很令人困惑。

我邀请你创建一个#feature 主题来分享你的建议 :slight_smile:

完成!

2 个赞

对话继续于:Respect the visibility settings of all automatic groups