FIX: Change the limit on badges description

The current limit (250 characters) is too low, as we have some
translations used for our badge descriptions that result in a
description length of 264 characters.

To be on the safe side, the limit is now set to 500 characters.
This commit is contained in:
Loïc Guitaut 2023-05-09 11:10:12 +02:00 committed by Loïc Guitaut
parent 43302d4089
commit ae369b1100
2 changed files with 2 additions and 2 deletions

View File

@ -119,7 +119,7 @@ class Badge < ActiveRecord::Base
validates :badge_type, presence: true
validates :allow_title, inclusion: [true, false]
validates :multiple_grant, inclusion: [true, false]
validates :description, length: { maximum: 250 }
validates :description, length: { maximum: 500 }
validates :long_description, length: { maximum: 1000 }
scope :enabled, -> { where(enabled: true) }

View File

@ -5,7 +5,7 @@ RSpec.describe Badge do
subject(:badge) { Fabricate.build(:badge) }
it { is_expected.to validate_length_of(:name).is_at_most(100) }
it { is_expected.to validate_length_of(:description).is_at_most(250) }
it { is_expected.to validate_length_of(:description).is_at_most(500) }
it { is_expected.to validate_length_of(:long_description).is_at_most(1000) }
it { is_expected.to validate_presence_of(:name) }
it { is_expected.to validate_presence_of(:badge_type) }