Discourse Private Replies

Github: GitHub - communiteq/discourse-private-replies

This plugin hides topic replies for everyone but the topic starter and the post author.

Use cases

This can be used for for instance homework assignments where the teacher opens a topic and posts an assignment, and all students make a post with their answers. When everyone has submitted their work, the teacher can open up the answers so the students will be able to discuss them.

A second use case can be an auction where something is offered for sale. People can post their bid and when the sale is done, the topic owner can reveal all bids in order to show the community that everything went according to the rules.

Usage

After installing and enabling the plugin you can turn on the functionality of the plugin on a per-topic basis.

If you are the topic-starter then you will see a new button at the bottom of the topic.

button

By pressing this button you have enabled the Private Replies feature for this topic.

A banner will appear above the topic and the following happens:

  • people will only be able to see posts made by themself, by the topic owner, and by staff.
  • only the topic owner will be able to see all posts.

banner

By pressing the button a second time, the topic will revert back to normal.

The plugin will, when enabled, allow private replies on all topics. However, if the setting private replies on selected categories only is enabled, the plugin can be enabled per category in the category security settings.

In that same screen you can also find the setting to enable private replies by default for all new topics in that category. This is especially handy when topics are being submitted by email.

image

Caveats

The plugin disables the following ways to retrieve the post contents:

  • topic view (i.e. the regular way of looking at posts)
  • user profile - activity
  • search
  • raw (/raw/topic_id/post_id)

However, you can still find out who posted in the topic:

  • The topic list icons will still show who has posted in the topic.
  • You will also be able to see ‘user xxx is replying’ at the bottom of the topic.
  • The topics are also visible in the user profile - summary.

However, all of these do not reveal the contents of the post.

Background:

So my SO is a teacher (ancient Greek and classical Latin) and has been using Discourse in her classes for a number of years now. She uses it mainly to distribute assignments to her students and discuss them afterwards. However, all the assignments are being handed in on paper during her classes.

Until now - since the schools have been closed because of all the corona panic she is moving to 100% online teaching, including the assignments. So all those students are currently e-mailing their work to her. This is very sub-optimal since it requires her to do quite a lot of administration (and I can tell you she is not very good at those kind of things :wink: ).

We were discussing a few options and she said: “why can’t I have a topic where people can only see my posts (i.e. the posts made by the topic starter) and their own posts? This would allow me to post an assignment as a topic and have every student post their answers below it without being able to see all the other answers. Then when everybody has entered their work and it is time to discuss, I want to be able to press a button to make the veil go away and make all posts in the topic visible to everyone, so they can all see and discuss each others work.”

Yes - brilliant! (that’s why I love her). So I made a plugin for this. Previous discussion here: Topic replies invisible until topic owner decides to reveal them?

69 Likes

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

9 Likes

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

14 Likes

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.

10 Likes

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).
7 Likes

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!

5 Likes

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.

5 Likes

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.

4 Likes

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?
5 Likes

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 Like

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 Likes

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 Likes

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

1 Like

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

2 Likes

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 Likes

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

3 Likes

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 Like

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.

1 Like

@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 Likes

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 Likes