UX: Remove 'Create Topics' notice (#21958)
We are looking at simplifying the new admin/user experience and the many notices bring unnecessary complexity.
This commit is contained in:
parent
1ae91fe95f
commit
4973f0ccde
|
@ -1,7 +0,0 @@
|
||||||
{{#unless this.hidden}}
|
|
||||||
<div class="row">
|
|
||||||
<div class="alert alert-info alert-too-few-topics">
|
|
||||||
{{this.message}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{/unless}}
|
|
|
@ -1,118 +0,0 @@
|
||||||
import discourseComputed, { observes } from "discourse-common/utils/decorators";
|
|
||||||
import Component from "@ember/component";
|
|
||||||
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,
|
|
||||||
|
|
||||||
requiredTopics: 5,
|
|
||||||
requiredPosts: alias("siteSettings.tl1_requires_read_posts"),
|
|
||||||
|
|
||||||
init() {
|
|
||||||
this._super(...arguments);
|
|
||||||
if (this.shouldSee) {
|
|
||||||
let topicCount = 0,
|
|
||||||
postCount = 0;
|
|
||||||
|
|
||||||
// Use data we already have before fetching live stats
|
|
||||||
this.site.get("categories").forEach((c) => {
|
|
||||||
if (!c.get("read_restricted")) {
|
|
||||||
topicCount += c.get("topic_count");
|
|
||||||
postCount += c.get("post_count");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (topicCount < this.requiredTopics || postCount < this.requiredPosts) {
|
|
||||||
this.set("enabled", true);
|
|
||||||
this.fetchLiveStats();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
@discourseComputed(
|
|
||||||
"siteSettings.show_create_topics_notice",
|
|
||||||
"router.currentRouteName"
|
|
||||||
)
|
|
||||||
shouldSee(showCreateTopicsNotice, currentRouteName) {
|
|
||||||
return (
|
|
||||||
this.currentUser?.get("admin") &&
|
|
||||||
showCreateTopicsNotice &&
|
|
||||||
!this.site.get("wizard_required") &&
|
|
||||||
!currentRouteName.startsWith("wizard")
|
|
||||||
);
|
|
||||||
},
|
|
||||||
|
|
||||||
@discourseComputed(
|
|
||||||
"enabled",
|
|
||||||
"shouldSee",
|
|
||||||
"publicTopicCount",
|
|
||||||
"publicPostCount"
|
|
||||||
)
|
|
||||||
hidden(enabled, shouldSee, publicTopicCount, publicPostCount) {
|
|
||||||
return (
|
|
||||||
!enabled ||
|
|
||||||
!shouldSee ||
|
|
||||||
publicTopicCount == null ||
|
|
||||||
publicPostCount == null
|
|
||||||
);
|
|
||||||
},
|
|
||||||
|
|
||||||
@discourseComputed(
|
|
||||||
"publicTopicCount",
|
|
||||||
"publicPostCount",
|
|
||||||
"topicTrackingState.incomingCount"
|
|
||||||
)
|
|
||||||
message(publicTopicCount, publicPostCount) {
|
|
||||||
let msg = null;
|
|
||||||
|
|
||||||
if (
|
|
||||||
publicTopicCount < this.requiredTopics &&
|
|
||||||
publicPostCount < this.requiredPosts
|
|
||||||
) {
|
|
||||||
msg = "too_few_topics_and_posts_notice_MF";
|
|
||||||
} else if (publicTopicCount < this.requiredTopics) {
|
|
||||||
msg = "too_few_topics_notice_MF";
|
|
||||||
} else {
|
|
||||||
msg = "too_few_posts_notice_MF";
|
|
||||||
}
|
|
||||||
|
|
||||||
return htmlSafe(
|
|
||||||
I18n.messageFormat(msg, {
|
|
||||||
requiredTopics: this.requiredTopics,
|
|
||||||
requiredPosts: this.requiredPosts,
|
|
||||||
currentTopics: publicTopicCount,
|
|
||||||
currentPosts: publicPostCount,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
},
|
|
||||||
|
|
||||||
@observes("topicTrackingState.incomingCount")
|
|
||||||
fetchLiveStats() {
|
|
||||||
if (!this.enabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
LivePostCounts.find().then((stats) => {
|
|
||||||
if (stats) {
|
|
||||||
this.set("publicTopicCount", stats.get("public_topic_count"));
|
|
||||||
this.set("publicPostCount", stats.get("public_post_count"));
|
|
||||||
if (
|
|
||||||
this.publicTopicCount >= this.requiredTopics &&
|
|
||||||
this.publicPostCount >= this.requiredPosts
|
|
||||||
) {
|
|
||||||
this.set("enabled", false); // No more checks
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
|
|
@ -53,7 +53,6 @@
|
||||||
<NotificationConsentBanner />
|
<NotificationConsentBanner />
|
||||||
<PwaInstallBanner />
|
<PwaInstallBanner />
|
||||||
<GlobalNotice />
|
<GlobalNotice />
|
||||||
<CreateTopicsNotice />
|
|
||||||
<PluginOutlet
|
<PluginOutlet
|
||||||
@name="top-notices"
|
@name="top-notices"
|
||||||
@connectorTagName="div"
|
@connectorTagName="div"
|
||||||
|
|
|
@ -1970,42 +1970,6 @@ en:
|
||||||
staff_writes_only_mode:
|
staff_writes_only_mode:
|
||||||
enabled: "This site is in staff only mode. Please continue to browse, but replying, likes, and other actions are limited to staff members only."
|
enabled: "This site is in staff only mode. Please continue to browse, but replying, likes, and other actions are limited to staff members only."
|
||||||
|
|
||||||
# This string uses the ICU Message Format. See https://meta.discourse.org/t/7035 for translation guidelines.
|
|
||||||
too_few_topics_and_posts_notice_MF: |
|
|
||||||
Let's <a href="https://blog.discourse.org/2014/08/building-a-discourse-community/" target="_blank" rel="noopener noreferrer">start the discussion!</a> There { currentTopics, plural,
|
|
||||||
one {is <strong>#</strong> topic}
|
|
||||||
other {are <strong>#</strong> topics}
|
|
||||||
} and { currentPosts, plural,
|
|
||||||
one {<strong>#</strong> post}
|
|
||||||
other {<strong>#</strong> posts}
|
|
||||||
}. Visitors need more to read and reply to – we recommend at least { requiredTopics, plural,
|
|
||||||
one {<strong>#</strong> topic}
|
|
||||||
other {<strong>#</strong> topics}
|
|
||||||
} and { requiredPosts, plural,
|
|
||||||
one {<strong>#</strong> post}
|
|
||||||
other {<strong>#</strong> posts}
|
|
||||||
}. Only staff can see this message.
|
|
||||||
|
|
||||||
# This string uses the ICU Message Format. See https://meta.discourse.org/t/7035 for translation guidelines.
|
|
||||||
too_few_topics_notice_MF: |
|
|
||||||
Let's <a href="https://blog.discourse.org/2014/08/building-a-discourse-community/" target="_blank" rel="noopener noreferrer">start the discussion!</a> There { currentTopics, plural,
|
|
||||||
one {is <strong>#</strong> topic}
|
|
||||||
other {are <strong>#</strong> topics}
|
|
||||||
}. Visitors need more to read and reply to – we recommend at least { requiredTopics, plural,
|
|
||||||
one {<strong>#</strong> topic}
|
|
||||||
other {<strong>#</strong> topics}
|
|
||||||
}. Only staff can see this message.
|
|
||||||
|
|
||||||
# This string uses the ICU Message Format. See https://meta.discourse.org/t/7035 for translation guidelines.
|
|
||||||
too_few_posts_notice_MF: |
|
|
||||||
Let's <a href="https://blog.discourse.org/2014/08/building-a-discourse-community/" target="_blank" rel="noopener noreferrer">start the discussion!</a> There { currentPosts, plural,
|
|
||||||
one {is <strong>#</strong> post}
|
|
||||||
other {are <strong>#</strong> posts}
|
|
||||||
}. Visitors need more to read and reply to – we recommend at least { requiredPosts, plural,
|
|
||||||
one {<strong>#</strong> post}
|
|
||||||
other {<strong>#</strong> posts}
|
|
||||||
}. Only staff can see this message.
|
|
||||||
|
|
||||||
logs_error_rate_notice:
|
logs_error_rate_notice:
|
||||||
# This string uses the ICU Message Format. See https://meta.discourse.org/t/7035 for translation guidelines.
|
# This string uses the ICU Message Format. See https://meta.discourse.org/t/7035 for translation guidelines.
|
||||||
reached_hour_MF: |
|
reached_hour_MF: |
|
||||||
|
|
|
@ -2255,7 +2255,6 @@ en:
|
||||||
embed_post_limit: "Maximum number of posts to embed."
|
embed_post_limit: "Maximum number of posts to embed."
|
||||||
embed_username_required: "The username for topic creation is required."
|
embed_username_required: "The username for topic creation is required."
|
||||||
notify_about_reviewable_item_after: "If there are reviewable items that haven’t been handled after this many hours, send a personal message to moderators. Set to 0 to disable."
|
notify_about_reviewable_item_after: "If there are reviewable items that haven’t been handled after this many hours, send a personal message to moderators. Set to 0 to disable."
|
||||||
show_create_topics_notice: "If the site has fewer than 5 public topics, show a notice asking admins to create some topics."
|
|
||||||
|
|
||||||
delete_drafts_older_than_n_days: "Delete drafts older than (n) days."
|
delete_drafts_older_than_n_days: "Delete drafts older than (n) days."
|
||||||
delete_merged_stub_topics_after_days: "Number of days to wait before automatically deleting fully merged stub topics. Set to 0 to never delete stub topics."
|
delete_merged_stub_topics_after_days: "Number of days to wait before automatically deleting fully merged stub topics. Set to 0 to never delete stub topics."
|
||||||
|
|
|
@ -2446,10 +2446,6 @@ uncategorized:
|
||||||
type: float
|
type: float
|
||||||
default: 48
|
default: 48
|
||||||
|
|
||||||
show_create_topics_notice:
|
|
||||||
client: true
|
|
||||||
default: true
|
|
||||||
|
|
||||||
enable_system_avatars:
|
enable_system_avatars:
|
||||||
hidden: true
|
hidden: true
|
||||||
default: true
|
default: true
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
.has-full-page-chat {
|
.has-full-page-chat {
|
||||||
.global-notice,
|
.global-notice,
|
||||||
.create-topics-notice,
|
|
||||||
.bootstrap-mode-notice {
|
.bootstrap-mode-notice {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue