Maintenance of the Question Answer Plugin

Maintenance of the Question Answer Plugin
0

The Question Answer plugin allows you to turn a Discourse topic into a Question / Answer format similar to Stack Overflow. Further details here:

This project is to find, train and establish a Pavilion member as the new maintainer of this plugin.

If this is taken on by a new member, please note:

Hi @angus. I’d be interested in becoming maintainer of this plugin.

4 Likes

Fantastic! That’s great, we can discuss it more tomorrow on our call.

Have a read of the meta topic, and also a think about how we can improve the OP with the plugin description, ideally to adopt (with improvements if you have any) our plugin template:

2 Likes

@pacharanero A new PR has been made to the Question Answer plugin. Do you want to dip your toe in here and review it? If not no worries, but thought I’d give you the chance.

1 Like

Thanks @angus. Yes I’ve had a first look over of this and it looks sensible, but haven’t reviewed in detail or been able to test locally yet.

What do we do in terms of:

  • testing? (manual / automated?)
  • code review? (ad-hoc / structured?)
  • where we comment? (here or in GH?)
1 Like

Cool, thanks.

I’ve just posted a full write up of plugin maintenance that covers testing, code review and comments:

(let me know if it’s incomplete)

2 Likes

@pacharanero Another user of the plugin has expressed some interest in the PR:

Let me know if you’re up for handling it

Any news about this PR? Looks like a quite useful feature :slight_smile:

@darkchill I’ve looked over the code but haven’t had time to test it in a live system yet. I may get time today but am in my other job today so can’t guarantee :slight_smile: @angus I’m happy for you to merge if you get to it sooner than that.

This PR merged by @angus today

1 Like

FYI, I also made PR yesterday to QA plugin which was merged today.

It adds answer_count to TopicListItemSerializer which is essential for a client project and useful enough generally.

1 Like

Hi @fzngagan,
I pulled the changes on my local clone and when I try to use it I get:

! Unable to load application: NoMethodError: undefined method `attributes' for TopicListItemSerializer:Class
Did you mean?  attr_writer
bundler: failed to load command: puma (/home/user/.rbenv/versions/2.6.2/bin/puma)
NoMethodError: undefined method `attributes' for TopicListItemSerializer:Class
Did you mean?  attr_writer

Do you have an idea what is the reason for this error?

attributes is an instance related thing. I think you’re calling it from class itself.

What do you mean? I just pulled the code as it is from Github. Shouldn’t it work as it is?

We have it working fine on two of our instances. Can you provide some more details?

1 Like

I’m trying to run: bundle exec puma
And I get:

Puma starting in single mode...
* Version 3.12.1 (ruby 2.6.2-p47), codename: Llamas in Pajamas
* Min threads: 0, max threads: 16
* Environment: development
Starting CSS change watcher
70:M 25 Oct 16:19:38.410 * 1 changes in 3600 seconds. Saving...
70:M 25 Oct 16:19:38.448 * Background saving started by pid 972
972:C 25 Oct 16:19:39.548 * DB saved on disk
70:M 25 Oct 16:19:39.585 * Background saving terminated with success
! Unable to load application: NoMethodError: undefined method `attributes' for TopicListItemSerializer:Class
Did you mean?  attr_writer
bundler: failed to load command: puma (/home/user/.rbenv/versions/2.6.2/bin/puma)
NoMethodError: undefined method `attributes' for TopicListItemSerializer:Class
Did you mean?  attr_writer
  /home/user/forum/discourse/plugins/discourse-question-answer/lib/qa_topic_edits.rb:222:in `<class:TopicListItemSerializer>'
  /home/user/forum/discourse/plugins/discourse-question-answer/lib/qa_topic_edits.rb:221:in `<main>'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:319:in `block in load'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:291:in `load_dependency'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:319:in `load'
  /home/user/forum/discourse/plugins/discourse-question-answer/plugin.rb:84:in `block in activate!'
  /home/user/forum/discourse/lib/plugin/instance.rb:329:in `block in notify_after_initialize'
  /home/user/forum/discourse/lib/plugin/instance.rb:327:in `each'
  /home/user/forum/discourse/lib/plugin/instance.rb:327:in `notify_after_initialize'
  /home/user/forum/discourse/config/application.rb:296:in `each'
  /home/user/forum/discourse/config/application.rb:296:in `block in <class:Application>'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0/lib/active_support/lazy_load_hooks.rb:51:in `each'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/application/finisher.rb:129:in `block in <module:Finisher>'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:32:in `instance_exec'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:32:in `run'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:61:in `block in run_initializers'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/2.6.0/tsort.rb:347:in `each'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/2.6.0/tsort.rb:347:in `call'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:60:in `run_initializers'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/application.rb:363:in `initialize!'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/railtie.rb:190:in `public_send'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/railtie.rb:190:in `method_missing'
  /home/user/forum/discourse/config/environment.rb:7:in `<top (required)>'
  config.ru:6:in `require'
  config.ru:6:in `block in <main>'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:55:in `instance_eval'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:55:in `initialize'
  config.ru:in `new'
  config.ru:in `<main>'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:49:in `eval'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:49:in `new_from_string'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:40:in `parse_file'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/puma-3.12.1/lib/puma/configuration.rb:320:in `load_rackup'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/puma-3.12.1/lib/puma/configuration.rb:245:in `app'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/puma-3.12.1/lib/puma/runner.rb:147:in `load_and_bind'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/puma-3.12.1/lib/puma/single.rb:98:in `run'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/puma-3.12.1/lib/puma/launcher.rb:186:in `run'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/puma-3.12.1/lib/puma/cli.rb:80:in `run'
  /home/user/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/puma-3.12.1/bin/puma:10:in `<top (required)>'
  /home/user/.rbenv/versions/2.6.2/bin/puma:23:in `load'
  /home/user/.rbenv/versions/2.6.2/bin/puma:23:in `<top (required)>'

Not sure why I get this error.

Does the application boot up fine as a whole?
Although, puma starts up fine on my dev environment with the plugin on. I would suggest you to clone the plugin again and try.

As a debugging step, please try to run this command in rails console ::TopicListItemSerializer.attributes

and share the output.

It’s got to be something to do with this line

In the class definition of ::TopicListItemSerializer the method attributes is called, and that looks to be what’s throwing the stacktrace. But I can’t see what the problem might be.

Yes you are right. Could it be a problem with Ruby (version)?

Hmm. Probably not - otherwise the attributes method call further up in the same source file would also have thrown an error. Also Ruby version should be being fixed by the Dockerfile that Discourse Docker uses for the deployment container, so we will all be on very similar if not the same version.