mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
Lift name length limit of some models
Role name being limited to 30 characters does not work anymore with some translations of default seeded roles. Raising the limit to 256 characters like a lot of other models.
This commit is contained in:
@@ -41,7 +41,7 @@ class Enumeration < ApplicationRecord
|
||||
validates :name,
|
||||
uniqueness: { scope: %i(type project_id),
|
||||
case_sensitive: false }
|
||||
validates :name, length: { maximum: 30 }
|
||||
validates :name, length: { maximum: 256 }
|
||||
|
||||
scope :shared, -> { where(project_id: nil) }
|
||||
scope :active, -> { where(active: true) }
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ class Forum < ApplicationRecord
|
||||
acts_as_watchable permission: :view_messages
|
||||
|
||||
validates :name, :description, presence: true
|
||||
validates :name, length: { maximum: 30 }
|
||||
validates :name, length: { maximum: 256 }
|
||||
validates :description, length: { maximum: 255 }
|
||||
|
||||
def visible?(user = User.current)
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ class News < ApplicationRecord
|
||||
}, as: :commented, dependent: :delete_all
|
||||
|
||||
validates :title, presence: true
|
||||
validates :title, length: { maximum: 60 }
|
||||
validates :title, length: { maximum: 256 }
|
||||
validates :summary, length: { maximum: 255 }
|
||||
|
||||
acts_as_journalized
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ class Role < ApplicationRecord
|
||||
|
||||
validates :name,
|
||||
presence: true,
|
||||
length: { maximum: 30 },
|
||||
length: { maximum: 256 },
|
||||
uniqueness: { case_sensitive: true }
|
||||
|
||||
def self.givable
|
||||
|
||||
@@ -41,7 +41,7 @@ class Status < ApplicationRecord
|
||||
validates :name,
|
||||
presence: true,
|
||||
uniqueness: { case_sensitive: false },
|
||||
length: { maximum: 30 }
|
||||
length: { maximum: 256 }
|
||||
|
||||
validates :default_done_ratio, inclusion: { in: 0..100, allow_nil: true }
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ describe GlobalRole do
|
||||
|
||||
it { is_expected.to validate_presence_of :name }
|
||||
it { is_expected.to validate_uniqueness_of :name }
|
||||
it { is_expected.to validate_length_of(:name).is_at_most(30) }
|
||||
it { is_expected.to validate_length_of(:name).is_at_most(256) }
|
||||
|
||||
describe 'attributes' do
|
||||
before { @role = GlobalRole.new }
|
||||
|
||||
Reference in New Issue
Block a user