Question Answer Plugin

  1. images cutting screenshots on mobile

  1. tables stars cutting and mis aligning due to extra padding on left side

  1. The text is pushed to right side too much due to unnecessary left side padding

Please see this topic on your mobile and try skim through the answers you will understand my point

Also, compare our plugin UI with Quora and Stackoverflow UI on mobile, u will see we can do lot of improvements

Look SO also has padding but its Answers look 100% easy to read and the images, code, or tables none of it is cutting, anything rich except text cuts on right side of screen.

Also, look SO has implemented schema.org correctly and all its answers and it’s best answer shows in Google serp, it looks nice

but in discourse QnA plugin the QuestionAnswer schema markup is missing.

Now look how well and easy to read layout is of Quora on mobile,

Also, the best answer thing will allow to have schema markup show inGoogle serps. I think this plugin should be a complete QnA solution so if we use this, we dont need the solved plugin as this QnA plugin has morefeatures then solved. but Its upto u guys.

Yes, the sticky fixed upvote button and count as i read scroll through long answers will be helpful.

Also, the left side extra padding makes me hard to read user answers. The full width default discourse posts r much easier to read, you can have the count and upvote button on top.left of the topic like the heart icon is at bottom left of the answer. That way the upvote arrow will not take extra empty space and distort the post readability in mobile view and will not push content and cut content on right side.

The full schema.org markup for Google structuredata will really boost SEO visibility in search engines for pages using this plugin. I’d love to have that. Like you guys did on rating plugin. Any other testing needed, I’m happy to help.

So, in short, you’re saying:

  1. There needs to be a tweak of the responsive (i.e. mobile) UX to slightly decrease the padding.

  2. Add Schema markup.

I think those are reasonable requests. We’ll take a look at implementing them when we can.

1 Like

yes exactly, thanks for summing my thoughts up :slight_smile: and if possible to show the sticky fixed upvote arrow and vote count as I read through the long answers and scroll down, they will be good.

Also, i think the upvote arrow should be bigger solid, bolded and more visible, something like Stackoverflow or like that:

image
image

Basically the arrows should be bigger and easier to spot, and same goes for the count, the answer count should be a bit big visible number so we can easily see it, how much voted an answer is. Especially for desktop and mobile screens. right now arrow and count is too small and hard to read. You can also make them have rounded circles if it looks cute.

Something like,

Many Thanks for accepting my suggestions!

[1.4.0] - 2020-10-05

Added

  • German translation (thanks to DerFetzer)
  • Ability to move comment to answers (post admin actions → Move to answers)

Changed

  • Fix compatibility issues with Discourse latest tests-passed branch
3 Likes

I recently installed this plugin and replies to threads started to appear out of order in all parts of the site. A few others seem to have the same issue. The moderators moved the post into #support but maybe the issue needs to live here? Not sure so, I’m linking to that support post from here. If this is unnecessary, please let me know so I can delete this post.

Moving this discussion over here from #support

I’m running 2.7.0.beta1 and when I installed the Q&A plugin replies to posts started to appear in random order. Others started to exhibit the same issues identified in this thread.

@AJDurant came up with this query (below) to fix the order issue, but it did not solve the problem. The plugin still seems to post replies to posts in the wrong order. I uninstalled the plugin and ran:

rake posts:reorder_posts[1896]

but it did not reorder the previous posts.

I’m afraid to run this query without further investigation by someone qualified to evaluate the fix. Any thoughts on how to fix this?

 SELECT
    id,
    ROW_NUMBER() OVER (
      PARTITION BY
        topic_id
      ORDER BY
        created_at,
        post_number
    ) AS new_post_number
  FROM
    posts
  /*where*/
)
UPDATE
  posts AS p
SET
  sort_order = o.new_post_number
FROM
  ordered_posts AS o
WHERE
  p.id = o.id AND
  p.sort_order <> o.new_post_number

Hi all, just wanted to mention I ran into this problem on current TestsPass and removed the Question Answer plugin to resolve it.

Hey guys, @mbcahyono will respond in more detail soon, but in the meantime, can we clarify a few things.

@sunjam Did you see that issue after deleting the category? Also, did you just notice that issue in the logs or did it affect your site in any way?

@dfriestedt @AJDurant Please check if you have the plugin enabled in the category where the posts are appearing in a different order. The plugin will automatically order posts according to the QA order in categories where it is enabled (that is the intended behaviour). If you disable it in a category it will reorder the posts according to the normal post order.

For example, I just toggled the “Make all topics in this category QnA.” setting back and forth in the question and answer category on try.thepavilion.io and the posts re-ordered as expected (and no non-qa category topics affected). No custom queries involved.

When enabled

When disabled

If that’s not working for you, could also give us some more detail on

  • How long you’ve been using the plugin for (i.e. did this just happen recently?)
  • What other 3rd party plugins have you been using now or in the past
  • What custom sort queries you’ve been using?
  • Does your site use tags? If so does this only happen in topics with a tag?
  • Is the site setting qa enabled enabled?

If you just want to fix it

If you just want to fix the issue, regardless of whether this plugin has caused it or not, you don’t need to run a custom query, rather remove this and any other plugins that might be changing your sort order, then in your server run the following

./launcher enter app
rake posts:reorder_posts

That task will set the order of all posts on your site according to the normal order (when they were created). If that does not work for you, you have some other issue that is unrelated to this plugin. I can help you diagnose that further, but will need some more information.

@dfriestedt if you’re trying to pass a topic id in there (the task takes a topic id as an argument if you want to target a specific topic), try running it like this instead:

rake "posts:reorder_posts[1234]"
1 Like

Sorry for the issue. I’ve created a PR for this, waiting to be merged:
https://github.com/paviliondev/discourse-question-answer/pull/37

@dfriestedt Is this what you experienced? If not, I will look deeper into this and possibly fix the issue today.

2 Likes

I’ve merged the PR :+1:

2 Likes

This was occurring on all topics, not just QnA ones. We have a ‘Questions’ category when all topics are QnA, and also have the ‘question’ tag to make a topic QnA.

The behavior is slightly different now though, before the sort order they were given fixed them at the bottom of the list, now they are still out of order, but newer posts are below them.

1 Like

Thanks @AJDurant.

One of our clients experienced this issue, so I was able to take a closer look at a dataset where it was occuring. I believe one issue here might be the when topics where a QA tag is removed are handled.

I’ve started a PR that addresses this issue, which @mbcahyono and I will work on

https://github.com/paviliondev/discourse-question-answer/pull/38

The way to fix the issue for a specific topic is:

./launcher enter app
rails c
topic = Topic.find(<topic_id>) 
topic.posts.each { |p| p.update_columns(sort_order: p.post_number) }

If anyone needs any more hands on help addressing this issue on their server please reach out to me privately and I can help you address it (no charge).

1 Like

Sorry for not responding sooner. I’ve been traveling this week. I can confirm your code above is fixing the individual posts with issues.

I also confirmed that running the following command does NOT fix the problem

rake "posts:reorder_posts[1234]"

Is there a way to run this across all posts - basically loop over all posts?

And you’ve just run rake posts:reorder_posts by itself and it doesn’t work? Please try that again first.

If that doesn’t work you can run this

./launcher enter app
rails c
Post.update_all("sort_order = post_number")

We have figured out what the issue is. It was introduced back in August. We’ll push a fix for it shortly, with a test for the case.

https://github.com/paviliondev/discourse-question-answer/pull/38#issuecomment-739137531

2 Likes

I ran the above command and got the following error

root@REMOVE-web-only:/var/www/discourse# rake posts:reorder_posts
rake aborted!
PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint "post_timings_unique"
DETAIL:  Key (topic_id, post_number, user_id)=(1567, 20, 3) already exists.
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rack-mini-profiler-2.2.0/lib/patches/db/pg.rb:110:in `exec'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rack-mini-profiler-2.2.0/lib/patches/db/pg.rb:110:in `async_exec'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/mini_sql-0.3/lib/mini_sql/postgres/connection.rb:201:in `run'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/mini_sql-0.3/lib/mini_sql/postgres/connection.rb:173:in `exec'
/var/www/discourse/lib/tasks/posts.rake:368:in `block (3 levels) in <main>'
/var/www/discourse/lib/tasks/posts.rake:351:in `each'
/var/www/discourse/lib/tasks/posts.rake:351:in `block (2 levels) in <main>'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.3/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `block in transaction'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.3/lib/active_record/connection_adapters/abstract/transaction.rb:280:in `block in within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.3/lib/active_record/connection_adapters/abstract/transaction.rb:278:in `within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.3/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `transaction'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.3/lib/active_record/transactions.rb:212:in `transaction'
/var/www/discourse/lib/tasks/posts.rake:312:in `block in <main>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
Tasks: TOP => posts:reorder_posts
(See full trace by running task with --trace)

I did not run the second command once I saw the duplicate key error thinking that might be a larger issue.

That looks like an issue with your db that’s independent of this, but blocking a fix here. I’ll pm you shortly and we can debug that seperately.

2 Likes

Thanks @angus that all seems to be working correctly now :smiley:

Running latest release and seeing the following errors.

Message (49 copies reported)

Job exception: uninitialized constant Jobs::QaUpdateTopicsPostOrder
Did you mean? Jobs::UpdateTopicPostOrder
Jobs::QAUpdateTopicsPostOrder

Backtrace

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/inflector/methods.rb:284:in const_get' /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/inflector/methods.rb:284:in block in constantize’
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/inflector/methods.rb:280:in each' /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/inflector/methods.rb:280:in inject’
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/inflector/methods.rb:280:in constantize' /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/core_ext/string/inflections.rb:68:in constantize’
/var/www/discourse/app/jobs/base.rb:288:in enqueue' /var/www/discourse/app/jobs/onceoff/onceoff.rb:40:in block in enqueue_all’
/var/www/discourse/app/jobs/onceoff/onceoff.rb:37:in each' /var/www/discourse/app/jobs/onceoff/onceoff.rb:37:in enqueue_all’

Sorry for the issue. Working on it, waiting to be merged:

https://github.com/paviliondev/discourse-question-answer/pull/39

1 Like

Cool, I’m excited to see this merged and look forward to the fix. Happy Holidays.