mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
Staff can create uncategorized topics even if allow_uncategorized_topics is false
This commit is contained in:
parent
ed87a589ca
commit
2a33a35566
3 changed files with 12 additions and 6 deletions
|
@ -126,7 +126,12 @@ Discourse.Composer = Discourse.Model.extend({
|
||||||
// reply is always required
|
// reply is always required
|
||||||
if (this.get('missingReplyCharacters') > 0) return true;
|
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;
|
return false;
|
||||||
}.property('loading', 'canEditTitle', 'titleLength', 'targetUsernames', 'replyLength', 'categoryId', 'missingReplyCharacters'),
|
}.property('loading', 'canEditTitle', 'titleLength', 'targetUsernames', 'replyLength', 'categoryId', 'missingReplyCharacters'),
|
||||||
|
|
|
@ -25,12 +25,12 @@ Discourse.CategoryChooserView = Discourse.ComboboxView.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
none: function() {
|
none: function() {
|
||||||
if (!Discourse.SiteSettings.allow_uncategorized_topics) {
|
if (Discourse.User.currentProp('staff') || Discourse.SiteSettings.allow_uncategorized_topics) {
|
||||||
return 'category.choose';
|
|
||||||
} else if (Discourse.SiteSettings.allow_uncategorized_topics || this.get('showUncategorized')) {
|
|
||||||
return 'category.none';
|
return 'category.none';
|
||||||
|
} else {
|
||||||
|
return 'category.choose';
|
||||||
}
|
}
|
||||||
}.property('showUncategorized'),
|
}.property(),
|
||||||
|
|
||||||
template: function(text, templateData) {
|
template: function(text, templateData) {
|
||||||
if (!templateData.color) return text;
|
if (!templateData.color) return text;
|
||||||
|
|
|
@ -59,7 +59,8 @@ class Topic < ActiveRecord::Base
|
||||||
:if => Proc.new { |t|
|
:if => Proc.new { |t|
|
||||||
(t.new_record? || t.category_id_changed?) &&
|
(t.new_record? || t.category_id_changed?) &&
|
||||||
!SiteSetting.allow_uncategorized_topics &&
|
!SiteSetting.allow_uncategorized_topics &&
|
||||||
(t.archetype.nil? || t.archetype == Archetype.default)
|
(t.archetype.nil? || t.archetype == Archetype.default) &&
|
||||||
|
(!t.user_id || !t.user.staff?)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue