Show a warning to admins if the site has fewer than 5 topics.

This commit is contained in:
Neil Lalonde
2014-05-23 12:25:16 -04:00
parent 8267a451b2
commit 512771932a
3 changed files with 15 additions and 0 deletions

View File

@ -164,6 +164,15 @@ window.Discourse = Ember.Application.createWithMixins(Discourse.Ajax, {
notices.push(I18n.t("read_only_mode.enabled"));
}
if(Discourse.User.currentProp('admin')) {
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) {
notices.push(I18n.t("too_few_topics_notice"));
}
}
if(!_.isEmpty(Discourse.SiteSettings.global_notice)){
notices.push(Discourse.SiteSettings.global_notice);
}