mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
Show a warning to admins if the site has fewer than 5 topics.
This commit is contained in:
parent
8267a451b2
commit
512771932a
3 changed files with 15 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -498,6 +498,11 @@ Discourse.Composer = Discourse.Model.extend({
|
|||
// We created a new topic, let's show it.
|
||||
composer.set('composeState', CLOSED);
|
||||
saving = false;
|
||||
|
||||
// Update topic_count for the category
|
||||
var category = Discourse.Site.currentProp('categories').find(function(x) { return x.get('id') === (parseInt(createdPost.get('category'),10) || 1); });
|
||||
if (category) category.incrementProperty('topic_count');
|
||||
Discourse.notifyPropertyChange('globalNotice');
|
||||
}
|
||||
|
||||
composer.clearState();
|
||||
|
|
|
@ -442,6 +442,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 topics 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..."
|
||||
|
||||
|
|
Loading…
Reference in a new issue