Skip to content

Commit

Permalink
Staff can create uncategorized topics even if allow_uncategorized_top…
Browse files Browse the repository at this point in the history
…ics is false
  • Loading branch information
nlalonde committed Jan 15, 2014
1 parent ed87a58 commit 2a33a35
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
7 changes: 6 additions & 1 deletion app/assets/javascripts/discourse/models/composer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion app/models/topic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ def recover!
: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?)
}


Expand Down

0 comments on commit 2a33a35

Please sign in to comment.