Can plugins achieve selective reply visibility within topics, and how can I create one?

Hello community,

Discourse is an excellent forum with much functionality. I’m interested in finding out if there’s a way to let users to manually select the audience for their replies to a particular topic. While I am aware that there is a woderful “discourse-private-reply” plugin that can limits reply visibility to the topic creator, I am looking for a more fine-grained solution.

To clarify, supposing that I’m composing a reply whthin a topic, I would like to be able to create a whitelist of users who can see my reply before I click the ‘POST’ button. Essentially, I want to ensure that only the users I have selected are able to see my reply, while all others cannot.

Personally, I am a developer with some programming skills, but I have never worked on any Discourse plugin development before. If there are no existing plugins or tools that can provide the level of control I’m looking for, I would greatly appreciate any advice or guidance on the development approach, such as which “process” I should hook or which APIs I should call in order to achieve the desired functionality.

Any suggestions or insights would be greatly appreciated. Thank you for your time and help!

5 Likes

With the need for such fine grained access, you might need to consider if a regular public topic is the best solution. Maybe you can tell a bit more about your specific use case?

A good starting point would indeed be my private-replies plugin. I has a function called can_see_post_if_author_among which currently takes a topic. You should modify it to take a post. You should store the allowed users with the post in a custom field and then check the viewing user against that list.

The plugin also overrides the access control logic for raw posts, search, topic views and user profile activity.

That said, I expect you to run into quite some issues from both a performance and a UX point of view and especially if you have no experience with Discourse plugin development, this can be quite an undertaking, so I would again recommend you to consider if this is the best approach for your use case.

7 Likes

Thank you for your prompt response and for sharing your insights on this matter. I would like to provide an example use case where a teacher assigns different tasks to each student and requires them to publish their answers (reports) on a Discourse forum. In this scenario, 1) the teacher needs to be able to see each student’s answer, and 2) some students may want to keep their answers private while others seek comments, feedback, and interaction. Additionally, 3) teachers may provide comments that are not suitable for public viewing.

This need for control over posts can also apply to other situations, such as employees writing monthly reports or patients writing recovery logs. To abstract, it’s about meeting user requests for control rather than moderators planning everything in advance. This is especially important for small communities focused on producing high-quality content.

While Discourse is an excellent platform for large communities with thousands of users, it’s also a great option for building smaller, refined communities that encourage deeper thinking and in-depth discussion. Users should have more control over their well-written posts.

Regarding the development of a plugin for this feature, I appreciate your concern about balancing performance and user experience. Instead of immediately creating a complicated plugin, a better approach would be to maximize existing features. For example, by creating a category with multiple subcategories, each corresponding to an assignment, and having students submit their work to the appropriate subcategory. This allows for control over each topic, and creators can choose to make their topics public or visible to specific user groups. Taking such baby steps can help reduce workload and make it easier to validate the effectiveness of the feature.

In short, giving users more control over their posts is essential for creating niche communities with high-quality content and engagement. This will not only nurture these communities but also expand the potential uses for Discourse. It’s a new way to explore what Discourse can do.

Thank you for the opportunity to discuss this with you. :slightly_smiling_face:

2 Likes

This is exactly what the plugin was made for. You just need to do #2 and #3 with private messages or chat.

Creators can already choose between responses visible or not visible, and the plugin can also be set to have responses visible to people in the same primary group as the creator.
By using differerent categories with different access rights, you can further control who can view the entire topic and who cannot.

Again, no need to build extra, complex, fragile, functionality while this can be accomplished already by slightly changing the way you want to work.

Long story short, you have not convinced me that these changes are necessary. They will only add complexity, both for the users and for plugin maintenance.

I want to clarify that my intention was not to suggest any changes to discourse-private-reply. I understand that it provides valuable functionality for controlling visibility of posts.Thank you for the discussion on this matter.

2 Likes

Yeah, you’re right, I misphrased that, sorry for that. But my advice still stands: don’t solve this using complex technology, solve it by slightly changing the process.