diff --git a/app/assets/javascripts/discourse/app/components/reviewable-item.js b/app/assets/javascripts/discourse/app/components/reviewable-item.js index 9843038de4e..ff67e672a81 100644 --- a/app/assets/javascripts/discourse/app/components/reviewable-item.js +++ b/app/assets/javascripts/discourse/app/components/reviewable-item.js @@ -151,11 +151,11 @@ export default Component.extend({ // "fast track" to update the current user's reviewable count before the message bus finds out. if (performResult.reviewable_count !== undefined) { - this.currentUser.set( - "reviewable_count", + this.currentUser.updateReviewableCount( performResult.reviewable_count ); } + if (performResult.unseen_reviewable_count !== undefined) { this.currentUser.set( "unseen_reviewable_count", diff --git a/app/assets/javascripts/discourse/app/components/sidebar/common/community-section.js b/app/assets/javascripts/discourse/app/components/sidebar/common/community-section.js index 2ef6f167147..9a2e5174d85 100644 --- a/app/assets/javascripts/discourse/app/components/sidebar/common/community-section.js +++ b/app/assets/javascripts/discourse/app/components/sidebar/common/community-section.js @@ -1,5 +1,6 @@ import Component from "@glimmer/component"; import { inject as service } from "@ember/service"; +import { tracked } from "@glimmer/tracking"; import { customSectionLinks, @@ -13,29 +14,18 @@ export default class SidebarCommunitySection extends Component { @service appEvents; @service siteSettings; + @tracked sectionLinks; + @tracked moreSectionLinks; + @tracked moreSecondarySectionLinks; + + callbackId; headerActionsIcon; headerActions; - sectionLinks; - moreSectionLinks; - moreSecondarySectionLinks; - callbackId; constructor() { super(...arguments); - this.moreSectionLinks = this.#initializeSectionLinks([ - ...this.defaultMoreSectionLinks, - ...customSectionLinks, - ]); - - this.moreSecondarySectionLinks = this.#initializeSectionLinks([ - ...this.defaultMoreSecondarySectionLinks, - ...secondaryCustomSectionLinks, - ]); - - this.sectionLinks = this.#initializeSectionLinks( - this.defaultMainSectionLinks - ); + this.refreshSectionLinks(); this.callbackId = this.topicTrackingState.onStateChange(() => { this.sectionLinks.forEach((sectionLink) => { @@ -64,6 +54,22 @@ export default class SidebarCommunitySection extends Component { return []; } + refreshSectionLinks() { + this.moreSectionLinks = this.#initializeSectionLinks([ + ...this.defaultMoreSectionLinks, + ...customSectionLinks, + ]); + + this.moreSecondarySectionLinks = this.#initializeSectionLinks([ + ...this.defaultMoreSecondarySectionLinks, + ...secondaryCustomSectionLinks, + ]); + + this.sectionLinks = this.#initializeSectionLinks( + this.defaultMainSectionLinks + ); + } + #initializeSectionLinks(sectionLinkClasses) { return sectionLinkClasses.reduce((links, sectionLinkClass) => { const sectionLink = this.#initializeSectionLink(sectionLinkClass); diff --git a/app/assets/javascripts/discourse/app/components/sidebar/more-section-links.hbs b/app/assets/javascripts/discourse/app/components/sidebar/more-section-links.hbs index 0eb84ca6323..432b7701ee5 100644 --- a/app/assets/javascripts/discourse/app/components/sidebar/more-section-links.hbs +++ b/app/assets/javascripts/discourse/app/components/sidebar/more-section-links.hbs @@ -12,7 +12,7 @@ {{did-insert this.registerClickListener}} {{will-destroy this.unregisterClickListener}} > -