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