Categories: public vs. logged in only vs. restricted

Is there a way to distinguish between categories visible to logged in users only and categories visible to certain groups?

At the moment, I use CSS to hide the lock icon in front of all categories that are visible to logged-in users only. Now I would like to put a group icon in front of categories that are restricted to groups.

3 个赞

While I understand your question, I am thinking about the use case. Especially because only users who can see the categories, see the categories regardless of groups or logged-in state. So how would the differentiation help? I do not think there is way though, but I might be wrong.

The use case is the same as for the lock icons, which, I think, is to remind users: if you post here or share a link from here it won’t be accessible by everyone.

I feel like I don’t need that reminder for login-only categories, because very few categories on my site are visible to anonymous users. (Instead, I mark the publicly visible category’s with an :eye: icon to remind users that these are out in the open internet.)

For categories that have more restrictions than “must be logged in”, it can be less obvious that they’re for a more or less exclusive group only. New users might have been granted access to a group when they first created their account. So from day one they’re seeing a different set of categories than some other users, but unless the category name or description (if they read it) includes a hint, they couldn’t tell that a category is visible only to some. Older users might forget that this one category they once were granted access to is not in fact accessible by all.

So, in short, a quick visual reminder like the lock icon makes more sense to me for restricted categories than applying it to almost all categories on a mostly logged-in only site.

2 个赞

We’ve recently made a category restricted to a higher trust level and now people keep thinking those topics have been closed. Closed and restricted are different things and it is confusing for them to have the same icon. A lock is generally understood to indicate that the person seeing it doesn’t have full access, not that it is hidden from other people.

1 个赞

In the meantime, I decided to indicate in front of each category, what the level of access is. I’m using a globe for categories that are public (anonymous access), a “group” icon for categories accessible by logged-in users and a “friends” icon for other restricted categories.
Screen Shot 2020-10-13 at 09.55.39

2 个赞

您是如何实现这一点的?我认为这是一个很棒的主意,随着我们的网站逐渐拥有一些公共类别,我很想为它们做类似的事情。喜欢这个地球!

我很想实现:

  1. 设置为 everyone 的类别的 :globe_with_meridians:
  2. 未设置图标的类别,允许访问 trust_level_0
  3. 设置为所有其他类别的 :unlock:

Nathan,这个TC应该可以做到。

是的,这就是我使用的。在 svg-icons 字段中,输入 users, user-friends 以及您想要用于公共访问的任何符号(对于地球图标,我使用的是 Freepik 的图标,我已通过上传到主题组件的 sprite 添加到我的 Discourse 中)

我使用以下 CSS 隐藏了锁图标,该 CSS 已添加到主题组件中:

// no lock icon for private categories
.category .badge-category.clear-badge.restricted .d-icon-lock, 
.badge-category.clear-badge.restricted .d-icon-lock,
.category-list .category-text-title .d-icon-lock,
.category-box-heading .d-icon-lock {
    display:none;
}
1 个赞

我提出了一个你的想法的变体,我可以选择性地仅隐藏对 TL_0(手动)可访问的类别中的锁定图标。

由于没有一个方便的 CSS 类可以实现这一点,因此你必须分别针对要隐藏锁定图标的每个类别的悬停(title)和链接(href)属性:

// 隐藏 ux 类别的锁定图标
[title = "ux"], [href = "/c/ux/9"] {
     .d-icon {
         display: none;
     }
}

这当然会与“类别图标组件”中的任何图标冲突,但可以通过针对该类别的 .d-icon-lock(或你使用的任何图标)而不是 .d-icon 来缓解。


我刚刚编辑了该 CSS,因为我发现缺少一些图标。现在它工作得好多了,但如果更改类别结构,它很容易中断。

2 个赞

对这个进行一点更新,以便你可以将其与侧边栏一起使用:

// 隐藏 ux 类别的锁定图标
.sidebar-section-link-ux .prefix-badge {
    display: none;
}
.category-ux .list-controls, [href = "/c/ux/9"] {
    .d-icon-lock,  {
        display: none;
    }
}
1 个赞

对于类别选择下拉菜单,我添加了一个目标:

.category-ux .list-controls, [href = "/c/ux/9"], [data-value = "9"] {
    .d-icon-lock,  {
        display: none;
    }
}

另外,对于聊天频道,我建议:[href *= "chat/channel/9/"]

1 个赞