A platform for community discussion. Free, open, simple.
FIX: Disallow none as a category slug
Daniel Waterworth6aff51080944
diff --git a/app/models/category.rb b/app/models/category.rbindex 5af5eabac34..a38868add4a 100644--- a/app/models/category.rb+++ b/app/models/category.rb@@ -1,6 +1,10 @@# frozen_string_literal: trueclass Category < ActiveRecord::Base+ RESERVED_SLUGS = [+ 'none'+ ]+self.ignored_columns = %w{uploaded_meta_idsuppress_from_latest@@ -59,6 +63,7 @@ class Category < ActiveRecord::Basevalidate :permissions_compatibility_validatorvalidates :auto_close_hours, numericality: { greater_than: 0, less_than_or_equal_to: 87600 }, allow_nil: true+ validates :slug, exclusion: { in: RESERVED_SLUGS }after_create :create_category_definition