Question Answer Plugin

(Alan Tan) #114

Hmm the vote count column isn’t the critical one here since you can recalculate it from the post_actions. Unfortunately for @kinto_d, the columns have already been dropped.

(Angus McLeod) #115

There’s probably a ‘history’ record somewhere I can use to reconstitute any lost data for the period the migration was active. I would check now, but I’m sans laptop.

(Alan Tan) #116

Just in case, we removed the migration in

(Angus McLeod) #117

Much appreciated. Will handle the ‘migration’ to custom fields in this plugin asap.

(Ruth Cheesley) #118

Just to say, I had this issue having just rebuilt as part of a domain migration and had Discourse update itself (and plugins, it seems) which was causing a 500 error.

The logs were showing NoMethodError (undefined method vote_count' for NoMethodError (undefined methodvote_count’ for … etc.

Took some time to identify the issue as I thought initially it must be a routing error from the domain migration! That’ll teach me to remember to update plugins first! :flushed:

(Angus McLeod) #119

Ok, an update here. Sorry for the delay, this caught me at an inconvenient time.

I’ve just merged an update that:

  • Updates the plugin to use various custom_fields to store vote data and integrates that into a functionality identical post vote action UX.

  • Migrates existing post vote actions to the new custom_fields.

Example topic:

This should work seamlessly for anyone who did not upgrade Discourse between these commits:

If you did upgrade Discourse between these commits, after upgrading Discourse and this plugin the QA functionality will work fine, but all votes in existing QA topics will be ‘0’.

The best idea I’ve come up with so far to retrieve vote data for those that upgraded between those commits is to search the production logs for instances of PostAction create, filtering by type and reducing by PostAction destroy (filtered by type). If anyone else has a better idea, let me know.

Rebuilding data from server logs is something of a last ditch effort, but nonetheless if you upgraded in specified period and you’re interested in this solution, please let me know.

Uncaught Errors
Topic Ratings Plugin
(Kinto D) #120

After I update the plugin, I can’t delete the question post (including normal post). Does this just happen to me? or does this happen to others too?


Started DELETE "/t/37" for at 2018-07-15 07:26:14 +0000
Processing by TopicsController#destroy as */*
  Parameters: {"context"=>"/t/lounge-tesests/37", "id"=>"37"}
Clearing Active Record cache, this can happen if schema changed while site is running or in a multisite various databases are running different schemas. Consider running rake multisite:migrate.
Completed 500 Internal Server Error in 39ms (ActiveRecord: 14.6ms)
ActiveRecord::StatementInvalid (PG::UndefinedColumn: ERROR:  column "vote_count" of relation "posts" does not exist
LINE 1: ...osts" SET "bookmark_count" = 0, "like_count" = 0, "vote_coun...
: UPDATE "posts" SET "bookmark_count" = 0, "like_count" = 0, "vote_count" = 0 WHERE "posts"."id" = 59)
/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/rack-mini-profiler-1.0.0/lib/patches/db/pg.rb:95:in `exec'
Failed to handle exception in exception app middleware : PG::UndefinedColumn: ERROR:  column "vote_count" of relation "posts" does not exist

(Jay Pfaffman) #121

You might try a rebuild, especially if you upgraded from the web interface.

(Angus McLeod) #122

What version of the plugin and what version of discourse are you running?

(Jose C Gomez) #123

Installed this, pretty nice however it has an issue with the Badge Flairs on the “Sub replies” see below.

v2.1.0.beta2 +422

(Angus McLeod) #124

Thanks, now fixed :sun_with_face:

(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 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? - Question Answer - 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