Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Lift name length limit of some models

Christophe Bliardfb6c2964288e
diff --git a/app/models/enumeration.rb b/app/models/enumeration.rb
index a70407d48ea..d135358ff92 100644
--- a/app/models/enumeration.rb
+++ b/app/models/enumeration.rb
@@ -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) }
diff --git a/app/models/forum.rb b/app/models/forum.rb
index caedc309ff0..8efc97e1a15 100644
--- a/app/models/forum.rb
+++ b/app/models/forum.rb
@@ -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)
diff --git a/app/models/news.rb b/app/models/news.rb
index 8e6af7bbcfe..598a1cd1e2d 100644
--- a/app/models/news.rb
+++ b/app/models/news.rb
@@ -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
diff --git a/app/models/role.rb b/app/models/role.rb
index bf341e889d6..a599c0eeec2 100644
--- a/app/models/role.rb
+++ b/app/models/role.rb
@@ -58,7 +58,7 @@ class Role < ApplicationRecord
validates :name,
presence: true,
- length: { maximum: 30 },
+ length: { maximum: 256 },
uniqueness: { case_sensitive: true }
def self.givable
diff --git a/app/models/status.rb b/app/models/status.rb
index 7ddfe7f35a4..917fce252d4 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -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 }
diff --git a/spec/models/global_role_spec.rb b/spec/models/global_role_spec.rb
index 955672d1e7b..18403e0797d 100644
--- a/spec/models/global_role_spec.rb
+++ b/spec/models/global_role_spec.rb
@@ -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 }