Discourse 私人回复

Github: GitHub - communiteq/discourse-private-replies

此插件会隐藏主题回复,除了主题发起者和发帖人之外的所有人。

用途

例如,这可以用于家庭作业,老师会开启一个主题并发布作业,所有学生都会发布一个帖子来回答。当所有人都提交了他们的作品后,老师可以公开答案,这样学生就能讨论它们了。

第二个用途可以是一个拍卖,其中有物品出售。人们可以发布他们的出价,当交易完成后,主题所有者可以显示所有出价,以向社区展示一切都按照规则进行。

用法

安装并启用插件后,您可以按主题启用插件的功能。

如果您是主题发起者,您会在主题底部看到一个新按钮。

button

通过按下此按钮,您已为此主题启用了“私人回复”功能。

主题上方会出现一个横幅,并发生以下情况:

  • 人们只能看到他们自己、主题所有者以及选定组中用户发布的帖子。
  • 只有主题所有者才能看到所有帖子。

banner

再次按下按钮,主题将恢复正常。

启用插件后,它将允许在所有主题上进行私人回复。但是,如果启用了“仅在选定类别中启用私人回复”设置,则可以在类别安全设置中按类别启用插件。

在同一个屏幕上,您还可以找到为该类别中的所有新主题默认启用私人回复的设置。这在通过电子邮件提交主题时特别有用。

设置

  • private_replies_participants_can_see_all 如果启用,任何参与过该主题的人都可以看到所有回复
  • private_replies_min_trust_level_to_see_all 具有此信任级别或更高的人可以看到所有回复
  • private_replies_groups_can_see_all 这些组中的用户始终可以看到所有回复(默认:staff)
  • private_replies_see_all_from_groups 来自这些组中用户的帖子始终对所有人可见(默认:staff)
  • private_replies_topic_starter_primary_group_can_see_all 与主题所有者属于同一主要组的用户可以看到所有回复

注意事项

该插件禁用了以下检索帖子内容的方式:

  • 主题视图(即查看帖子的常规方式)
  • 用户个人资料 - 活动
  • 搜索
  • 原始 (/raw/topic_id/post_id)

但是,您仍然可以找出谁在主题中发帖:

  • 主题列表图标仍会显示谁在该主题中发帖。
  • 您还可以在主题底部看到“用户 xxx 正在回复”。
  • 主题也显示在用户个人资料 - 摘要中。

但是,所有这些都不会显示帖子的内容。

背景:

我的妻子是一位老师(古希腊和古典拉丁语),多年来一直在她的课堂上使用 Discourse。她主要用它来向学生分发作业并在之后进行讨论。然而,所有的作业都是在课堂上以纸质形式提交的。

直到现在——由于所有冠状病毒恐慌导致学校关闭,她正在转向 100% 在线教学,包括作业。所以,所有这些学生目前都在通过电子邮件向她发送他们的作品。这很不理想,因为它需要她进行大量的管理工作(我可以告诉你,她不擅长这类事情 :wink:)。

我们讨论了一些选项,她说:“为什么我不能有一个主题,让人们只能看到我的帖子(即主题发起者发布的帖子)和他们自己的帖子?这样我就可以将作业发布为一个主题,让每个学生在下面发布他们的答案,而看不到其他所有答案。然后当每个人都提交了他们的作品,到了该讨论的时候,我希望能够按一个按钮,让面纱消失,让所有主题中的帖子对每个人都可见,这样他们就可以看到并讨论彼此的作品。”

是的——太棒了!(这就是我爱她的原因)。所以我做了一个插件。之前的讨论在这里:Topic replies invisible until topic owner decides to reveal them?

77 个赞

New ways schools can adopt with Discourse! Nice job! :grinning:

10 个赞

Very cool and thank you for sharing this @RGJ :beers:

15 个赞

Great to see this!

My one nitpick is that I’d rather have the feature enabled at the category level, then replies can get revealed per-topic when everything’s submitted.

11 个赞

Very cool, I was wondering if there is a way to still access the contents of private replies:

  • by Group (Teachers)
  • Trust Level (all teachers are at least Trust Level 3).
9 个赞

Why do you think that’s better?

That’s a pretty good idea. It shouldn’t be too hard to add that to the plugin.
I’ll keep it in mind but right now I don’t have a use case for this myself. PR’s are welcome though!

6 个赞

Prevents random abuse from topic starters enabling the setting on non-intended categories. It’s a “why would you do that?” situation but still something that needs a flag to resolve.

7 个赞

Yeah, that’s useful indeed. So that could be solved by a category setting ‘allow private replies’.
I thought you wanted a ‘topics have private replies by default’ setting, which would be harder to build.

6 个赞

Hello, Richard! Your teacher should be happy because your plugin works great :grinning:

I think about 2 improvements:

  1. Is it possible to make this function active by default? This should be set in the category settings. No need to do it manually with every topic.
  2. Make replies visible to specific groups set in the settings?
7 个赞

Hi! I’d like to add translations to your plugin. Tried to add 2 extra files: client.en and server.en
Then I did ./launcher rebuild app, but the translation didn’t appear after I changed the locale in the user interface. What I missed?

1 个赞

The files should be called client.XX.yml and server.XX.yml where XX is the language code.

However, there are already files for en (English): https://github.com/communiteq/discourse-private-replies/tree/master/config/locales so I am not sure what you have done or what you are trying to accomplish.

3 个赞

I’ve done this exact thing (added client.de.yml and server.de.yml for the German language) and nothing changed.

  • Probably, I found the mistake. I missed the language code in the file. I’ll check it later.
2 个赞

Can you please make a PR once you’ve got things working? That would be much appreciated!

1 个赞

Everything is working, it was my mistake. I will add all languages to your fork when I finish it.

2 个赞

Hi! I got errors in /sidekiq from your plugin. Can you please check your installation? Do you have such errors?

Wrapped I18n::InvalidLocaleData: can not load translations from /var/www/discourse/plugins/discourse-private-replies/config/locales/server.ar.yml: #
<Psych::SyntaxError: (/var/www/discourse/plugins/discourse-private-replies/config/locales/server.ar.yml): did not find expected key while parsing a block mapping at line 3 column 5>

There is an extra " that should be removed.

private_replies_enabled: "قم بتمكين المكون الإضافي "الردود الخاصة."
2 个赞

Thank you for reporting this! I’ve pushed a fix.

3 个赞

Hey,
It won’t install from the admin interface. Is it hooks only?

The error is:

about.json does not exist. Are you sure this is a Discourse plugin?
1 个赞

I am not familiar with that error message. It is not part of the Discourse source code. Are you sure this is the exact message?

Plugins are not installed from the admin interface either.
Please refer to Install plugins on a self-hosted site.

2 个赞

@RGJ
My company, Haddee, is eager to develop some new features for the plugin.
I was wondering if you could put a license on it just to make contribution easier and smoother

Thanks :slight_smile:

6 个赞

Right, it worked installing from the hooks system indeed.
I guess it can’t be installed from the admin like themes and extensions as it has server features and that’s why it’s called a plug-in (so many specific terms and various ways to extend or customize Discourse that we can easily get lost as a dev)

This one seems clean and small enough to be easy to customize.

Thanks for the replies :wink:

2 个赞