DEV: Resolve deprecated use of `registerConnectorClass` (#262)

This commit is contained in:
David Taylor 2023-10-23 22:26:07 +01:00 committed by GitHub
parent 82b219699d
commit 8352a79145
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 29 deletions

View File

@ -1,4 +1,8 @@
<LinkTo @route="userActivity.solved">
{{d-icon "check-square"}}
{{i18n "solved.title"}}
</LinkTo>
{{#if this.siteSettings.solved_enabled}}
<li class="user-activity-bottom-outlet solved-list">
<LinkTo @route="userActivity.solved">
{{d-icon "check-square"}}
{{i18n "solved.title"}}
</LinkTo>
</li>
{{/if}}

View File

@ -0,0 +1,6 @@
import Component from "@glimmer/component";
import { inject as service } from "@ember/service";
export default class SolvedList extends Component {
@service siteSettings;
}

View File

@ -1,7 +1,11 @@
<LinkTo @route="userActivity.solved">
<UserStat
@value={{model.solved_count}}
@label="solved.solution_summary"
@icon="check-square"
/>
</LinkTo>
{{#if (and this.siteSettings.solved_enabled @outletArgs.solved_count)}}
<li class="user-summary-stat-outlet solved-count">
<LinkTo @route="userActivity.solved">
<UserStat
@value={{@outletArgs.model.solved_count}}
@label="solved.solution_summary"
@icon="check-square"
/>
</LinkTo>
</li>
{{/if}}

View File

@ -0,0 +1,6 @@
import Component from "@glimmer/component";
import { inject as service } from "@ember/service";
export default class SolvedCount extends Component {
@service siteSettings;
}

View File

@ -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 {