Question Answer Plugin

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

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

1 Like

@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

https://github.com/angusmcleod/discourse-question-answer/commit/9947bda6a8ca3a80d4f0a56d94ee63bb510b15ea

Hidden comments for an answer display if:

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

Example topic: https://discourse.angusmcleod.com.au/t/what-has-cities-but-no-houses-forests-but-no-trees-and-water-but-no-fish/55

Example post with qa comments default set at 2

5 Likes

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.

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”.

2 Likes

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

https://github.com/angusmcleod/discourse-question-answer/commit/3aa4decdbda75989d09c90f865de3e85d816d519

cc @sinister89

1 Like

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.

Summary

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.

Background

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.

https://discourse.angusmcleod.com.au/t/make-categories-more-verbose-about-your-plugins/157/5?u=bletch

  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.

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.

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

2 Likes

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

2 Likes

Will do.

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

I’ll test and report back.

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:

Thanks.

2 Likes

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.

1 Like

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

1 Like

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

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
c.save_custom_fields(true)
end

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.name
  c.custom_fields['qa_enabled'] = true
  c.save_custom_fields(true)
end
end
2 Likes

Thank you so much!
i Done!

My whole website is about Q&A which is depends on this plugin.
Lately I faced some issues that new or updated answers comes in the top while the questions goes to the bottom of the page. e.g أين توجد محلات بيع الدراعات الكويتيه بالكويت ؟ - السفر إلى الكويت - مجتمع ترانزيت اسئلة واجوبة المسافرون العرب

How can I resolve this.
I tried to Rebake posts, rebuild discourse but no success.

Sorry you’re having an issue. I’ll take a look tomorrow.

Looking at your site, it seems that topic is the only one with the issue. Are there any others?

As to that topic, I suspect the issue is caused by the fact that it’s a three year old topic and you installed the question answer plugin after the topic was created.

The recent post is a “comment” on an answer which is why it appears near the top (it is appearing correctly under the answer it is comment on).

The issue is that the question is appearing at the bottom of the topic for some reason. I’ve made a tweak to the order logic which should fix it. You’ll need to update and then create a new answer or comment in that topic (you can delete it afterwards).

https://github.com/angusmcleod/discourse-question-answer/commit/f44b72b603968a6d27449b6faedbaa8e78d34f4f

2 Likes