Discourse Solved (Accepted answer plugin)

official

(Sam Saffron) #1

About

The Discourse Solved plugin allows users to accept solutions on topics in designated categories.

Requirements

Discourse stable, beta or tests-passed

Installation

Repo is at: GitHub - discourse/discourse-solved: Allow accepted answers on topics

In your app.yml add:

hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - mkdir -p plugins
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/discourse/discourse-solved.git

And then rebuild the container:

./launcher rebuild app

Configuration

Edit category you wish to enable accepted answers on:

As the OP (topic creator) you will have a button that allows you to accept an answer

Accepted answers are highlighted in the topic list:

Accepted answers are highlighted on the initial topic:

Enable the empty box on unsolved setting to display an empty box next to unsolved topics

It is possible allow users to select solutions on all topics, regardless of the category, by enabling the site setting allow solved on all topics

Filters (Requires Discourse 1.8.0.beta6 or above)

You can filter by solved/unsolved topics by adding a parameter to the URL. For example:

https://meta.discourse.org/c/support?solved=yes

or

https://meta.discourse.org/c/support?solved=no

These links could be added above a specific category list by following the instructions here

Badges

As it stands our plugin system has no clean way of shipping badges and removing them when plugin is removed. While this is being solved you can add badges to your liking via the badge interface.

A badge for first accepted answer:

SELECT p.user_id, p.id post_id, p.updated_at granted_at
FROM badge_posts p
WHERE p.post_number > 1 AND 
    p.id IN (
      SELECT post_id FROM (
       SELECT pc.post_id, row_number() 
       OVER (PARTITION BY p1.user_id ORDER BY pc.created_at) as rnum
       FROM post_custom_fields pc
       JOIN badge_posts p1 ON p1.id = pc.post_id
       JOIN topics t1 ON p1.topic_id = t1.id
       WHERE name = 'is_accepted_answer' AND
                     value IS NOT NULL AND
                    p1.user_id <> t1.user_id AND 
        (
          :backfill OR 
           p1.user_id IN (
                   select user_id from posts where p1.id IN (:post_ids)
           )
       )
) X  WHERE rnum = 1)

For example: https://meta.discourse.org/badges/125/helpdesk

A badge for 10 accepted answers

SELECT id user_id, current_timestamp granted_at
FROM users
WHERE id  IN (
       SELECT p1.user_id 
       FROM post_custom_fields pc
       JOIN badge_posts p1 ON p1.id = pc.post_id
       JOIN topics t1 ON p1.topic_id = t1.id
       WHERE p1.user_id <> t1.user_id AND 
                    name = 'is_accepted_answer' AND 
                    value IS NOT NULL AND
            p1.user_id IN (
                   SELECT user_id 
                   FROM posts 
                   WHERE :backfill OR  p1.id IN (:post_ids)
            )
        GROUP BY p1.user_id
        HAVING COUNT(*) > 9
)
https://meta.discourse.org/badges/126/tech-support

Data Explorer Queries

To list each individual “solved” event:

SELECT acting_user_id, target_topic_id, target_post_id, created_at FROM user_actions
WHERE action_type=15
ORDER BY created_at DESC

To produce a list with stats per-user: (with variable for time interval, defaults to 1 year):

-- [params]
-- string :interval = 1 year
SELECT  ua.acting_user_id, 
        count(case t.user_id when ua.acting_user_id then 1 else null end) as is_op, 
        count(case t.user_id when ua.acting_user_id then null else 1 end) as not_op,
        count(*) as total
FROM user_actions ua
LEFT JOIN topics t ON target_topic_id = t.id
WHERE action_type=15
AND ua.created_at >= CURRENT_DATE - INTERVAL :interval
GROUP BY ua.acting_user_id
ORDER BY total DESC

Original spec discussion


This is an official plugin, we plan to ship it to all our customers. Thank you to Western Digital for funding the development of this plugin!


Solved Button Plugin
What is this checkbox icon in the topic list?
How do you enable a tick mark?
10 accepted answer badge giving an error?
«Real Name» plugin (version 4.0, 2015-07-31)
Mark as Solution feature?
Can't find "Allow topic owner and staff to mark a reply as the solution" Setting
About the solved category
No option appears to choose better answer
Question Answer Plugin
Thoughts on a plugin which turns discourse into stackoverflow
[Accepted answer plugin] Add an ability to accept the initial (topmost) post as a solution
Topic List Previews
Custom Solved badges are not being assigned to users
Adding Unsolved button to top menu using custom HTML
Pluging for right answer
How can I add new badges?
[PAID] Modify the official "Discourse Solved" plugin
Searching "Solved" posts
Automatic Second-Post Wiki?
What cool data explorer queries have you come up with?
Thoughts from community metrics conference
Plugin: 'Ask to Answer' Mechanism
Modify Top Menu buttons?
Deleted posts can be counted as unread
Image zoom is not working
Discourse Plug-ins : Where to start?
Question Answer Plugin
Solved badges: Difference between icon and image, precedence changed in 2.0.0beta10
What is SQL Badge Query for invited >25 People?
How To Mark a Topic As Resolved?
How can I turn discourse to Q&A based website?
Add Badge to Solve answer
Option to mark as solved
Mark all topics as solved specific category
Query to find out who marked the solution as solved
Upgrade to v1.4.0.beta4 - Can't create or modify tag
First Accepted Answer badge not granted
Invalid Article Schema
How can I fix or pin posts inside a topic
Discourse to Power Q & A Site?
Admin/mod ability to insert a post wherever
Discourse and Quandora (or other Q&A platform like StackOverflow)
Solved plugin: post menu button now hidden at far right, used to be on the left?
Discourse for helpdesk use cases?
(Sam Saffron) #232

All discussion on the topic of Discourse solved should live in the #plugin:solved topic.

Please do not reply here, just open new topics. Leaving topic open so it does not look confusing that we somehow “closed” the solved plugin.


(Adrianbblk) #235

As a suggestion, I think an “I have the same question” button would be great.

Many users just reply to a question with.“I have the same question”, and that’s load a topic too much for no reason and sometimes it makes other users to not open it because are thinking the answer was already posted.


(Régis Hanol) #236

Why not just :heart: the OP?


(Adrianbblk) #237

It’s about users act. On my forum particularly, the love/like button it’s very used.


(Jay Pfaffman) #238

You might try to teach people that the “like” button means “me too”, but you might also check out the retort plugin.


(Adrianbblk) #239

Teaching people something it’s a bit hard. You can very easily push them out if permanently ping them for mistakes. I don’t like the Retort plugin at all, because of the design I guess.