Also warn admins when there aren't at least 50 posts

This commit is contained in:
Neil Lalonde 2014-05-28 13:33:39 -04:00
parent f0620a7d21
commit 9aba666d3f
3 changed files with 11 additions and 5 deletions

View File

@ -165,10 +165,15 @@ window.Discourse = Ember.Application.createWithMixins(Discourse.Ajax, {
}
if(Discourse.User.currentProp('admin') && Discourse.SiteSettings.show_create_topics_notice) {
var topic_count = _.reduce(Discourse.Site.currentProp('categories'), function(sum,c) {
return sum + (c.get('read_restricted') ? 0 : c.get('topic_count'));
}, 0);
if (topic_count < 5) {
var topic_count = 0,
post_count = 0;
_.each(Discourse.Site.currentProp('categories'), function(c) {
if (!c.get('read_restricted')) {
topic_count += c.get('topic_count');
post_count += c.get('post_count');
}
});
if (topic_count < 5 || post_count < 50) {
notices.push(I18n.t("too_few_topics_notice"));
}
}

View File

@ -6,6 +6,7 @@ class BasicCategorySerializer < ApplicationSerializer
:text_color,
:slug,
:topic_count,
:post_count,
:description,
:topic_url,
:read_restricted,

View File

@ -446,7 +446,7 @@ en:
read_only_mode:
enabled: "An administrator has enabled read-only mode. You can continue to browse the site but interactions won't work properly."
login_disabled: "Login is disabled while the site is in read only mode."
too_few_topics_notice: "Create at least 5 public topics to get discussion started. New users won't be able to earn trust levels unless there's content for them to read."
too_few_topics_notice: "Create at least 5 topics and 50 posts to get discussion started. New users will not be able to earn trust levels unless there's content for them to read."
learn_more: "learn more..."