Question Answer Plugin


(Angus McLeod) #1

This is a Question Answer plugin that allows you to create topics in a similar QA style used by Stack Overflow.

There are two ways to turn a topic into a QA topic:

  • Via QA tag set in Admin > Settings > Plugins > qa tags
  • By making all topics in a category QA style topics: Category Settings > Settings > Enable QA style for topics in this category.

Features:

  • Up-votes, but no down-votes (yet)
  • The first post of the topic cannot be voted on (yet). Adding this would raise some overlap with Discourse Feature Voting.
  • Subsequent posts can be up-voted. One vote per user per topic.
  • Posts are arranged, first by the number of votes they have received, then by the date they were posted.

Here’s where this plugin fits into the array of similar plugins and features available in Discourse:

  • “Like” button. There is already a way of expressing support for a post in Discourse in the form of the like button. The main difference between that button and this plugin is that this plugin re-arranges the posts in the topic based on those that have been supported. This plugin may also add the ability to ‘down vote’ posts.

  • Solved Plugin. The Solved Plugin is an official Discourse plugin. It also allows you to create QA style topics, but of a different style. The Solved Plugin allows the original poster (or an admin) to select a solution to the question in the first post. In contrast, this plugin allows each user of the forum a vote on what they think is the best answer.

  • Feature Voting Plugin. This plugin allows you to vote on topics themselves, as opposed to specific posts. There is a great discussion of the thinking behind this in the plugin topic and associated spec.

You can see it in action here (make an account and click Ask, or see this topic for an example). Note that the funky compose you see on that instance is a separate plugin.


Thoughts on a plugin which turns discourse into stackoverflow
How can I turn discourse to Q&A based website?
Are there Upvotes/Downvotes, Score for the Posts?
[PAID-Job] Convert Wordpress Q&A to Discourse Q&A
Some Improvements to Encourage Users to ask questions ? Make People Engage
Elections Plugin
Learning Ember.js before developing on Discourse
Thoughts on a plugin which turns discourse into stackoverflow
[Paid] Develop "Ask me question" plugin in user profile
Is there any forecast for Discourse to have reputation system?
(DiscourseMetrics.com) #2

This looks great! Can’t wait to test it out :slight_smile:


(Daniela) #3

Many thanks for the sandbox @angus!
@system is a little too friendly, he is continuing to send me Welcome messages.

Now I have 6, in case I forget to read it :joy: (now 7)

and I cannot create new topic under “New Discussion” :

He really hate me now


(Angus McLeod) #4

Sorry about that! There was an issue with the ‘discovery-composer’ which was preventing new posts from going through (forcing all to the approval queue). This has been resolved.


#5

Great Plugin. Installed on my forum.

One request can we disable showing the upvotes count if the post has 0 upvotes? It does not look good to show 0.


(Ted Strauss) #6

If anyone has used the Solved plugin, which is the official Discourse Q&A plugin (i think), it would be helpful to know how these two plugins compare.


(Angus McLeod) #7

Good question! The Solved Plugin is indeed an official Discourse plugin. However it works differently from this plugin. The Solved Plugin allows the original poster (or an admin) to select a solution to the question in the first post. In contrast, this plugin allows each user of the forum a vote on what they think is the best answer. Different forums will want different kinds of Question / Answer style topics.

I’ve added a brief description of similar plugins and Discourse features to the original post:

Here’s where this plugin fits in to the array of similar plugins and features available in Discourse:

  • “Like” button. There is already a way of expressing support for a post in Discourse in the form of the like button. The main difference between that button and this plugin is that this plugin re-arranges the posts in the topic based on those that have been supported. This plugin may also add the ability to ‘down vote’ posts.
  • Solved Plugin. The Solved Plugin is an official Discourse plugin. It also allows you to create QA style topics, but of a different style. The Solved Plugin allows the original poster (or an admin) to select a solution to the question in the first post. In contrast, this plugin allows each user of the forum a vote on what they think is the best answer.
  • Feature Voting Plugin. This plugin allows you to vote on topics themselves, as opposed to specific posts. There is a great discussion of the thinking behind this in the plugin topic and associated spec.

#8

2 features I think are worth exploring are

  1. Displaying total votes for a user in their profile
  2. Displaying the top voted posts in their user profile
    I’ll try to rough out these features in the coming weeks.

(Angus McLeod) #9

Good ideas. In the same vein, perhaps a ‘badge’ would also be appropriate, like the Helpdesk badge. Happy to work with you on each of these.


#10

Can your plugin be used in combination with the Solved plugin?


#11

I currently have both running in my instance. In the end, I think the upvoting mainly plays literally a positional role, moving posts up or down. In conjunction, I think both provide a Stack Overflow-type style.


(Angus McLeod) #12

Technically the logic doesn’t conflict, so yes the plugins can literally be used side by side without any issues.

The voting mechanism this plugin uses actually already exists in Discourse’s code, it’s just not visible. There is a vote action, and even logic that re-arranges the sort_order property of posts based on number of votes, already in the core Discourse code that is not currently usable in normal Discourse clients. This plugin exposes that action and logic.

The Solved Plugin, by contrast, uses post_custom_fields to store a boolean value about each post on a topic that can have an accepted answer (if post is accepted = true), and also uses topic_custom_fields to store the post id of the accepted post (if it exists).

However, there is an open question about what kind of QA system this creates (i.e. a product question). If the OP or an admin can select the solution to a question, then this mitigates the weighting of the ‘crowd-sourced’ method of selecting the answer.

Using them together would create a system a bit like the federal election primaries here in the US. The popular vote for the party’s candidate is mitigated by the votes of the ‘super delegates’ (the OP and the Admins).


(Pad Pors) #13

is it possible to use the QA button for another purpose: to filter and show topics which are QA listed below the button, as well as to use it as a composer in QA?

the same rule for wiki, rating, and discuss button.


(Pad Pors) #14

how can one set up the funky compose like this sandbow?

and why the composer doesn’t let you decide about the category?

how can one have the category list space?

p.s.: I’m confused if it’d better to write this as a new topic or here. sorry if I put it in the wrong place.


(Angus McLeod) #15

The composer on my dev site is a work in progress. It will change quite significantly soon.[quote=“Pad_Pors, post:14, topic:56032”]
how can one set up the funky compose like this sandbow?
[/quote]

It’s a combination of this plugin with this plugin, but I wouldn’t recommend using it yet.

The discovery composer is context dependent. It assumes you’re using category navigation in a sidebar. The context (i.e. category when you’re in a discovery route) is set in a plugin like the map navigation widget.

This is a category list widget that I built for the map navigation widget to allow the user to select the category. You can also navigate by clicking on items on the map.


(Pad Pors) #16

Thanks for the description,

does this mean like this: if I choose Brazil as the category in the sidebar (using the map), any topic that I post will be in the Brazil category.

just like what happens currently in simple discourse, when we are in a category, and we open create topic, then the default category of the new topic is the category we’re in. correct?


(Angus McLeod) #17

Correct. Posting in the discovery composer I have built is entirely context dependent. Why restrict it like this? Because the use case I’ve built it for ties categories to physical locations, giving them a somewhat different character to normal categories in a normal non-location-specific forum. If you’re specifically tying content to a location, you don’t really want your users to be so easily able to post new content in different locations. Someone can only be in one place at once.

*edit. If you’d like to discuss this further, let’s do so in the custom layouts plugin topic. It’s a little off topic here.


(Hugo Lpz) #18

I think your plugin indeed is a key plugin for a QA-SO feels.
I would recommend you to rename your plugin tho. -QA is too general. What your plugin does is more specific : posts voting and sorting. Be clear : this is great and it’s complementary to other plugins you rightly cite, which together provide multiple bricks to pick as needed to get closer to a QA feels.

See also :
[1] : Plugin which turns discourse into stackoverflow


(Angus McLeod) #19

What would you suggest I call it? “Post Voting and Sorting Plugin” doesn’t exactly roll off the tongue :slight_smile:


(Hugo Lpz) #20

What would you suggest I call it? “Post Voting and Sorting Plugin” doesn’t exactly roll off the tongue :slight_smile:

@angus, my name proposal : “Discourse Answers Voting”. Sounds net.
The sorting function should be default but optional (can be disabled), as some Discourse.org users may cherish the chronological sorting. Limit your plugin to just that and its associated effects on the right-side elevator would fit well with other plugins, existing or likely to come.