Question Answer Plugin

(Shashank Singla) #125

@angus I had the same issue. I am using version 0.2

I reported this as a issue here 500 Error when Deleting Post · Issue #9 · angusmcleod/discourse-question-answer · GitHub

(Angus McLeod) #126

@sinister89 @kinto_d @barreeeiroo Thanks guys, there was indeed an issue. Should be fixed now. Please update and try again.

500 Error when Deleting Post
(Shashank Singla) #127

@angus is there an easy way to collapse the comments and hide them and give a button which user needs to click to show comments, like in medium?

Thought behind this feature request is that if the comments are too many or too long, then distract the user from the Answers. Quora and Stackoverflow also do some kind of collapsing but that might need more work.



(Angus McLeod) #128

Yeah, that’s doable. Remind me next Friday and I’ll do it next weekend.

(Shashank Singla) #129

Hi @angus, just a reminder for implementing the hiding comments features.

Again, thank you so much for doing this! Really appreciate it!

(Angus McLeod) #130

@sinister89 I’ve added a visibility toggle for comments. You can set the number of comments to show by default using the site setting qa comments default

Hidden comments for an answer display if:

  • the “show [x] more comments” link for that answer is clicked.
  • user starts to compose a comment on that answer.

Example topic: What has cities, but no houses; forests, but no trees; and water, but no fish? - QnA - Angus' Sandbox

Example post with qa comments default set at 2

(Evgeny) #131

This is a good change, but if you change useragent on (Android):

Mozilla/5.0 (Android; Mobile; rv:13.0) Gecko/13.0 Firefox/13.0

then the topic will be empty. Perhaps some errors, with the change of the template.

(Shashank Singla) #132

Thankd @angus for the change, really helpful.

I am also seeing the same issue as reported by @Stranik.

I have attached the console log. You can replicate this in a chrome browser by using the device toolbar view of “Galaxy S5”.

(Angus McLeod) #133

Thanks for the report. Please see if this fixed it.

cc @sinister89

(Evgeny) #134

Hiding of the comments is working. Thanks.

I unfortunately do not use the plugin, but only part of the code, and perhaps I have only a private case. If there is a new notification, clicking on them, my throws are not at all the answer, and in the middle of the theme. Yet again, maybe it’s just me. I tested it on my computer.

(Danny Goodall) #135


I believe there may be a bug with QA Plugin - but it might be another plugin from your studio @angus.

On a post that is a reply to a previous, nonadjacent post above, pressing the link to the original poster/post opens the summary of that post but throws JS Console errors.

After these errors the page no longer receives updates. Pressing like registers a like with the server but does not refresh the like symbol, new posts no longer automatically appear, etc.


It’s been driving me crazy for some time trying to centre in on the cause. Finally, I’ve been able to reproduce the issue on my dev site with the QA Plugin enabled and see the issue disappear when the QA Plugin is disabled.

However, on my live site I have disabled the QA Plugin and the error is still there - hence my comment that it might be shared code with one of your other plugins which are still enabled (but I’m guessing there).

Steps to reproduce

I’ve managed to reproduce this on your sandbox, @angus. Follow these steps.

  1. Go to this post of mine which is a reply to ryanerwin.
  1. Click on the link to the replied post and the replied to post should appear.

  1. Open the JavaScript Console

  2. Press the like :heart: on your post “Sure thing, go ahead” (although I believe any like you press will reproduce the problem).

  3. You should see an error in the console

  1. You’ll notice that your like will not have been reflected in the user interface - but probably has hit the server.

Let me know if you need any more information or if you are not able to reproduce it. I guess it could be something in my environment that is causing the issue.

Cheers, Bletch.

(Jay Pfaffman) #136

On a site that I have just upgraded, the timeline scroll bar is missing. Disabling the Question Answer Plugin with safe-mode makes it come back.

Also, was there a bug a while back that let someone un-vote more times than they’d voted? We had a post with -26 votes. I can’t replicate it, so I guess it’s been fixed, but knowing that such a bug existed would explain the anomaly.

(Angus McLeod) #137

@bletch @pfaffman Thanks guys. I’ll take a look at both issues tomorrow.

(Angus McLeod) #138

@bletch I’ve made a few changes. Please update and let me know how it goes.

@pfaffman Is the timeline disabled in all topics or just QnA topics? It’s meant to be disabled in QnA topics because the timeline doesn’t make sense in the context of a non-chronological topic order.

Not that I know of, but it’s possible. I can’t repro this in the current version of the plugin. The voting mechanism was changed substantially when this plugin went from using the (now removed) vote_count property in core Discourse to using custom fields (a month or so ago now). It could have been present in the old mechanism.

Are negative votes a live issue in any way?

(Danny Goodall) #139

Will do.

Did you update your sandbox? The issue is still reproducible there

I’ll test and report back.

(Jay Pfaffman) #140

Doh! That’s it. And I think that all categories are QnA.

I can’t replicate the negative votes either. I’ve fixed up the one topic by hand and told them that unless it can be replicated it can’t be fixed. :slight_smile:


(Danny Goodall) #141

Hi @angus, I’ve tested the latest version of the QA Plugin on our live site and I can’t reproduce the problem.

As I mention above, I’m wondering if the problem is in code shared across plugins because I re-enabled your Elections Plugin (which I had disabled whilst trying to track down the bug) and I was then able to reproduce the problem again.

Both the Elections and the QA Plugin were enabled at that point.

Disabling the Elections plugin, but leaving the QA Plugin enabled meant that I was no longer able to reproduce the problem.

So it looks fixed in the QA Plugin but maybe still present in the Elections Plugin?

Thanks for all your efforts, it’s really appreciated out there in Discourse land!

Cheers, Bletch.

Rails plugin generator
(Angus McLeod) #142

@bletch You’re right, the same issue is also present in the elections plugin. Nice sleuthing :male_detective:

I can see what’s causing it, but the solution I used for QnA won’t work for elections. I’ll have to take a closer look on the weekend.

(Sora &\) #143

I have alot of category, about 2500 category, How do i setup all of them enable Answer Plugin?
Thank you!

(Angus McLeod) #144

If you want to literally make all categories QA:

./launcher enter app
rails c
Category.all.each do |c|
c.custom_fields['qa_enabled'] = true

But you’ll probably want to exclude some categories (you’ll need to update the part that starts 'other names...').

./launcher enter app
rails c
Category.all.each do |c|
if ['Staff', 'other names of categories you want to exclude'].exclude?
  c.custom_fields['qa_enabled'] = true