FIX: do not show "create topics" notice on wizard route (#18153)

This commit is contained in:
Arpit Jalan 2022-09-01 16:37:57 +05:30 committed by GitHub
parent 7e74dd0afe
commit 5bc858c676
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,11 +4,13 @@ import I18n from "I18n";
import LivePostCounts from "discourse/models/live-post-counts";
import { alias } from "@ember/object/computed";
import { htmlSafe } from "@ember/template";
import { inject as service } from "@ember/service";
export default Component.extend({
classNameBindings: ["hidden:hidden", ":create-topics-notice"],
enabled: false,
router: service(),
publicTopicCount: null,
publicPostCount: null,
@ -37,14 +39,16 @@ export default Component.extend({
}
},
@discourseComputed()
shouldSee() {
const user = this.currentUser;
@discourseComputed(
"siteSettings.show_create_topics_notice",
"router.currentRouteName"
)
shouldSee(showCreateTopicsNotice, currentRouteName) {
return (
user &&
user.get("admin") &&
this.siteSettings.show_create_topics_notice &&
!this.site.get("wizard_required")
this.currentUser?.get("admin") &&
showCreateTopicsNotice &&
!this.site.get("wizard_required") &&
!currentRouteName.startsWith("wizard")
);
},