有没有办法隐藏已查看列?

Some of my users dont like this option:

1 个赞

Per user, no we do not have this option, you can suppress it globally via CSS.

3 个赞

If hiding it for all users in an option, this would be the CSS to globally suppress the “last seen” user profile stat:

// Hide the "Last Seen" section of the user profile
.user-main .about .secondary dl div:nth-child(3) {
    display: none;
}
5 个赞

Hi! I am working on a Discourse instance that wants to invite people from various backgrounds and wants to provide a safe, secure and trusting environment.
I am wondering if in the future you would consider having a setting to globally turn off the Seen information (in group lists and anywhere else)? We would like to give a promise to our users that no other user can see when they were last online (i.e. the information is also not accessible when inspecting the html).

If the answer is no, I wonder if you can give advice for how to go about what I mentioned above? I am still quite new to this, so I would like to know if it’s best to hire someone to edit the source code or would a plugin or a component work?

Thank you very much!

I’m not sure about your actual question but this discussion relates to your issue:

It documents the setting that hides the user card:
hide_user_profiles_from_public

3 个赞

Thank you for your comment!
We already hide the user cards, I think that’s a good feature.
However, I am concerned that in the future people in my community will want to hide the “seen” information even from logged in users. So, I just wanted to check what our options are if that time comes.

2 个赞

抱歉顶帖了,但我找不到任何关于这个问题的最新帖子。能够隐藏一些“已读”和“在线状态”信息,即使是对已登录用户,也是为了给用户提供更多隐私。

有没有什么新的设置可以控制这个?我们应该提出一个功能请求吗?

1 个赞

是否可以添加 CSS 类来隐藏特定用户的“最后在线”时间?

我想为我的个人资料隐藏它,因为人们给我发消息,然后就能看到我最后在线的时间。如果几天不回复(我无法立即处理所有事情),但他们可以看到我最近在线,因为他们反复查看我的个人资料,有时只是因为我打开了一个标签页但没有查看网站,这会很尴尬。

没有人应该期望别人仅仅因为在场就为他们做任何事。这是你的人生,你有你的职责。所以我想设定界限会有所帮助,例如在你的个人资料中写明。比如“我很忙,我会在一周内回复你”。或者“请只期望我回答关于 X 和 Y 的问题,其他问题请等待社区”。

所以我认为这更多是其他人的问题。就像你在现实生活中看到某人,然后他们就冲过来让你立刻做一件非常重要的事情一样!

这比那要复杂,但我无法详细解释。压力可能很大。

3 个赞

我同意。有时是我自己在检查,所以当我知道用户在线但没有回复我时,我会感到紧张。

1 个赞

纯 CSS 不可能实现,没有节点路径可以使用您的用户名来定位“最后看到”的元素。

使用 JavaScript,这应该可以工作:

<script type="text/discourse-plugin" version="1.4.0">
  function hideLastSeen() {
    if (location.pathname.startsWith("/u/j127")) {
      document.querySelectorAll(".last-seen-at").forEach(el => el.remove());
    }
  }

  api.onPageChange(hideLastSeen);

  document.addEventListener("DOMContentLoaded", hideLastSeen);
</script>

提供


供未来的读者参考,请查看下面的更好脚本,该脚本可防止错误地定位用户(避免在使用 .startsWith("/u/john") 时定位名为“johndoe”的用户)。

1 个赞

如果开启安全模式,这个还会工作吗?

1 个赞

是的。管理员如有必要,可以为非员工禁用安全模式 :slight_smile:

2 个赞

但是,好奇的用户仍然可以从 JSON 响应中读取信息,对吗?

1 个赞

是的。作为仅客户端的自定义,它始终是一个“软限制”。用户可能足够坚定(和知识渊博)来利用这种弱点,也可能不够坚定(和知识渊博)。

2 个赞

太好了,这很有用。

编辑: 我将其更改为以下内容,以使其不区分大小写:

<script type="text/discourse-plugin" version="1.4.0">
    function shouldHideLastSeen() {
        const p = location.pathname.toLowerCase();
        return p === "/u/username" || p.startsWith("/u/username/");
    }

    function hideLastSeen() {
        if (shouldHideLastSeen()) {
            document.querySelectorAll(".last-seen-at").forEach(el => el.remove());
        }
    }

    api.onPageChange(hideLastSeen);
    document.addEventListener("DOMContentLoaded", hideLastSeen);
</script>
1 个赞