Staff can create uncategorized topics even if allow_uncategorized_topics is false

This commit is contained in:
Neil Lalonde 2014-01-15 15:58:15 -05:00
parent ed87a589ca
commit 2a33a35566
3 changed files with 12 additions and 6 deletions

View File

@ -126,7 +126,12 @@ Discourse.Composer = Discourse.Model.extend({
// reply is always required
if (this.get('missingReplyCharacters') > 0) return true;
if (this.get('canCategorize') && !Discourse.SiteSettings.allow_uncategorized_topics && !this.get('categoryId')) return true;
if (this.get('canCategorize') &&
!Discourse.SiteSettings.allow_uncategorized_topics &&
!this.get('categoryId') &&
!Discourse.User.currentProp('staff')) {
return true;
}
return false;
}.property('loading', 'canEditTitle', 'titleLength', 'targetUsernames', 'replyLength', 'categoryId', 'missingReplyCharacters'),

View File

@ -25,12 +25,12 @@ Discourse.CategoryChooserView = Discourse.ComboboxView.extend({
},
none: function() {
if (!Discourse.SiteSettings.allow_uncategorized_topics) {
return 'category.choose';
} else if (Discourse.SiteSettings.allow_uncategorized_topics || this.get('showUncategorized')) {
if (Discourse.User.currentProp('staff') || Discourse.SiteSettings.allow_uncategorized_topics) {
return 'category.none';
} else {
return 'category.choose';
}
}.property('showUncategorized'),
}.property(),
template: function(text, templateData) {
if (!templateData.color) return text;

View File

@ -59,7 +59,8 @@ class Topic < ActiveRecord::Base
:if => Proc.new { |t|
(t.new_record? || t.category_id_changed?) &&
!SiteSetting.allow_uncategorized_topics &&
(t.archetype.nil? || t.archetype == Archetype.default)
(t.archetype.nil? || t.archetype == Archetype.default) &&
(!t.user_id || !t.user.staff?)
}