Solved plugin bug

Oops, I thought I already replied to this topic.

Few days ago I was looking into this issue and was able to repro this consistently. In fact I can repro this right now here on meta!


Repro Steps:

  1. Click “Create a new category” button.
  2. Open “Settings” tab.
  3. Tick “Allow topic owner and staff to mark a reply as the solution” checkbox.
  4. Notice there will be an error in console.

I tried to fix this issue and was able to pinpoint the code causing this issue:

https://github.com/discourse/discourse-solved/blob/master/assets/javascripts/discourse/pre-initializers/extend-category-for-solved.js.es6#L18

this.set("custom_fields.enable_accepted_answers", value);

^^ custom_fields is not defined when creating new category, however it is defined when editing the category.

I spent considerable time on this issue and was not sure how to fix this. :frowning:

@eviltrout can you look into this?


Also related:

https://meta.discourse.org/t/discourse-solved-accepted-answer-plugin/30155/108?u=techapj

7 Likes