diff --git a/assets/javascripts/discourse/initializers/extend-for-solved-button.js.es6 b/assets/javascripts/discourse/initializers/extend-for-solved-button.js.es6 index 5219f59..a3de8ca 100644 --- a/assets/javascripts/discourse/initializers/extend-for-solved-button.js.es6 +++ b/assets/javascripts/discourse/initializers/extend-for-solved-button.js.es6 @@ -9,6 +9,7 @@ import PostCooked from "discourse/widgets/post-cooked"; import { formatUsername } from "discourse/lib/utilities"; import { iconHTML } from "discourse-common/lib/icon-library"; import { iconNode } from "discourse-common/lib/icon-library"; +import SearchAdvancedOptions from "discourse/components/search-advanced-options"; function clearAccepted(topic) { const posts = topic.get("postStream.posts"); @@ -262,6 +263,16 @@ export default { }) }); + SearchAdvancedOptions.reopen({ + didInsertElement() { + this._super(); + this.statusOptions.push({ + name: I18n.t("search.advanced.statuses.solved"), + value: "solved" + }); + } + }); + withPluginApi("0.1", initializeWithApi); withPluginApi("0.8.10", api => { diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 2bf9f6e..b7bf1d2 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -27,3 +27,8 @@ en: topic_statuses: solved: help: "This topic has a solution" + + search: + advanced: + statuses: + solved: "are solved" diff --git a/plugin.rb b/plugin.rb index 77d9601..19af807 100644 --- a/plugin.rb +++ b/plugin.rb @@ -465,7 +465,7 @@ SQL #TODO Remove when plugin is 1.0 if Search.respond_to? :advanced_filter - Search.advanced_filter(/in:solved/) do |posts| + Search.advanced_filter(/status:solved/) do |posts| posts.where("topics.id IN ( SELECT tc.topic_id FROM topic_custom_fields tc @@ -475,7 +475,7 @@ SQL end - Search.advanced_filter(/in:unsolved/) do |posts| + Search.advanced_filter(/status:unsolved/) do |posts| posts.where("topics.id NOT IN ( SELECT tc.topic_id FROM topic_custom_fields tc