FIX: Change to new discourse plugin-api for advanced search options (#91)

Changed to new discourse plugin-api and added status:unsolved option
This commit is contained in:
Ahmed Gagan 2020-09-11 15:45:34 +05:30 committed by GitHub
parent 613267c3a2
commit 945974a5e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 11 deletions

View File

@ -10,7 +10,6 @@ import PostCooked from "discourse/widgets/post-cooked";
import { formatUsername } from "discourse/lib/utilities"; import { formatUsername } from "discourse/lib/utilities";
import { iconHTML } from "discourse-common/lib/icon-library"; import { iconHTML } from "discourse-common/lib/icon-library";
import { iconNode } 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) { function clearAccepted(topic) {
const posts = topic.get("postStream.posts"); const posts = topic.get("postStream.posts");
@ -264,16 +263,6 @@ 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.1", initializeWithApi);
withPluginApi("0.8.10", (api) => { withPluginApi("0.8.10", (api) => {
@ -282,5 +271,20 @@ export default {
"check-square" "check-square"
); );
}); });
withPluginApi("0.11.0", (api) => {
api.addAdvancedSearchOptions({
statusOptions: [
{
name: I18n.t("search.advanced.statuses.solved"),
value: "solved",
},
{
name: I18n.t("search.advanced.statuses.unsolved"),
value: "unsolved",
},
],
});
});
}, },
}; };

View File

@ -32,6 +32,7 @@ en:
advanced: advanced:
statuses: statuses:
solved: "are solved" solved: "are solved"
unsolved: "are unsolved"
admin: admin:
web_hooks: web_hooks: