mirror of
				https://github.com/discourse/discourse.git
				synced 2025-02-25 18:55:32 -06:00 
			
		
		
		
	DEV: allow to have duplicate topic titles if categegory is different (#10034)
Co-authored-by: Robin Ward <robin.ward@gmail.com> Co-authored-by: Robin Ward <robin.ward@gmail.com>
This commit is contained in:
		@@ -155,7 +155,12 @@ class Topic < ActiveRecord::Base
 | 
			
		||||
                                    message: :has_already_been_used,
 | 
			
		||||
                                    allow_blank: true,
 | 
			
		||||
                                    case_sensitive: false,
 | 
			
		||||
                                    collection: Proc.new { Topic.listable_topics } }
 | 
			
		||||
                                    collection: Proc.new { |t|
 | 
			
		||||
                                      SiteSetting.allow_duplicate_topic_titles_category? ?
 | 
			
		||||
                                        Topic.listable_topics.where("category_id = ?", t.category_id) :
 | 
			
		||||
                                        Topic.listable_topics
 | 
			
		||||
                                    }
 | 
			
		||||
                                  }
 | 
			
		||||
 | 
			
		||||
  validates :category_id,
 | 
			
		||||
            presence: true,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user