mirror of
https://github.com/discourse/discourse.git
synced 2025-03-22 23:45:58 +08:00
BUGFIX: category name is reserved in multisite
This commit is contained in:
parent
ee8bbadfe8
commit
759f4b4fe9
@ -55,13 +55,17 @@ class Topic < ActiveRecord::Base
|
|||||||
:case_sensitive => false,
|
:case_sensitive => false,
|
||||||
:collection => Proc.new{ Topic.listable_topics } }
|
:collection => Proc.new{ Topic.listable_topics } }
|
||||||
|
|
||||||
validates :category_id, :presence => true ,:exclusion => {:in => [SiteSetting.uncategorized_category_id]},
|
validates :category_id,
|
||||||
:if => Proc.new { |t|
|
:presence => true,
|
||||||
(t.new_record? || t.category_id_changed?) &&
|
:exclusion => {
|
||||||
!SiteSetting.allow_uncategorized_topics &&
|
:in => Proc.new{[SiteSetting.uncategorized_category_id]}
|
||||||
(t.archetype.nil? || t.archetype == Archetype.default) &&
|
},
|
||||||
(!t.user_id || !t.user.staff?)
|
:if => Proc.new { |t|
|
||||||
}
|
(t.new_record? || t.category_id_changed?) &&
|
||||||
|
!SiteSetting.allow_uncategorized_topics &&
|
||||||
|
(t.archetype.nil? || t.archetype == Archetype.default) &&
|
||||||
|
(!t.user_id || !t.user.staff?)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
before_validation do
|
before_validation do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user