diff --git a/assets/javascripts/discourse/connectors/user-activity-bottom/solved-list.hbs b/assets/javascripts/discourse/connectors/user-activity-bottom/solved-list.hbs index 23e48f3..201cb6e 100644 --- a/assets/javascripts/discourse/connectors/user-activity-bottom/solved-list.hbs +++ b/assets/javascripts/discourse/connectors/user-activity-bottom/solved-list.hbs @@ -1,4 +1,8 @@ - - {{d-icon "check-square"}} - {{i18n "solved.title"}} - \ No newline at end of file +{{#if this.siteSettings.solved_enabled}} +
  • + + {{d-icon "check-square"}} + {{i18n "solved.title"}} + +
  • +{{/if}} \ No newline at end of file diff --git a/assets/javascripts/discourse/connectors/user-activity-bottom/solved-list.js b/assets/javascripts/discourse/connectors/user-activity-bottom/solved-list.js new file mode 100644 index 0000000..35ea7e0 --- /dev/null +++ b/assets/javascripts/discourse/connectors/user-activity-bottom/solved-list.js @@ -0,0 +1,6 @@ +import Component from "@glimmer/component"; +import { inject as service } from "@ember/service"; + +export default class SolvedList extends Component { + @service siteSettings; +} diff --git a/assets/javascripts/discourse/connectors/user-summary-stat/solved-count.hbs b/assets/javascripts/discourse/connectors/user-summary-stat/solved-count.hbs index 9743c85..9329da9 100644 --- a/assets/javascripts/discourse/connectors/user-summary-stat/solved-count.hbs +++ b/assets/javascripts/discourse/connectors/user-summary-stat/solved-count.hbs @@ -1,7 +1,11 @@ - - - \ No newline at end of file +{{#if (and this.siteSettings.solved_enabled @outletArgs.solved_count)}} +
  • + + + +
  • +{{/if}} \ No newline at end of file diff --git a/assets/javascripts/discourse/connectors/user-summary-stat/solved-count.js b/assets/javascripts/discourse/connectors/user-summary-stat/solved-count.js new file mode 100644 index 0000000..6452089 --- /dev/null +++ b/assets/javascripts/discourse/connectors/user-summary-stat/solved-count.js @@ -0,0 +1,6 @@ +import Component from "@glimmer/component"; +import { inject as service } from "@ember/service"; + +export default class SolvedCount extends Component { + @service siteSettings; +} diff --git a/assets/javascripts/discourse/initializers/extend-for-solved-button.js b/assets/javascripts/discourse/initializers/extend-for-solved-button.js index 6f61aa8..2991492 100644 --- a/assets/javascripts/discourse/initializers/extend-for-solved-button.js +++ b/assets/javascripts/discourse/initializers/extend-for-solved-button.js @@ -188,24 +188,6 @@ function initializeWithApi(api) { this.appEvents.trigger("post-stream:refresh", { id: p.id }); }); }); - - if (api.registerConnectorClass) { - api.registerConnectorClass("user-activity-bottom", "solved-list", { - shouldRender(args, component) { - return component.siteSettings.solved_enabled; - }, - }); - api.registerConnectorClass("user-summary-stat", "solved-count", { - shouldRender(args, component) { - return ( - component.siteSettings.solved_enabled && args.model.solved_count > 0 - ); - }, - setupComponent() { - this.set("classNames", ["linked-stat"]); - }, - }); - } } export default {