mirror of
https://github.com/discourse/discourse.git
synced 2025-01-20 15:47:32 +08:00
DEV: Set limits for text fields in reviewables
This commit is contained in:
parent
b4cf990a51
commit
783c935dcb
|
@ -36,6 +36,8 @@ class Reviewable < ActiveRecord::Base
|
||||||
enum :priority, { low: 0, medium: 5, high: 10 }, scopes: false, suffix: true
|
enum :priority, { low: 0, medium: 5, high: 10 }, scopes: false, suffix: true
|
||||||
enum :sensitivity, { disabled: 0, low: 9, medium: 6, high: 3 }, scopes: false, suffix: true
|
enum :sensitivity, { disabled: 0, low: 9, medium: 6, high: 3 }, scopes: false, suffix: true
|
||||||
|
|
||||||
|
validates :reject_reason, length: { maximum: 500 }
|
||||||
|
|
||||||
after_create { log_history(:created, created_by) }
|
after_create { log_history(:created, created_by) }
|
||||||
|
|
||||||
after_commit(on: :create) { DiscourseEvent.trigger(:reviewable_created, self) }
|
after_commit(on: :create) { DiscourseEvent.trigger(:reviewable_created, self) }
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
RSpec.describe Reviewable, type: :model do
|
RSpec.describe Reviewable, type: :model do
|
||||||
|
describe "Validations" do
|
||||||
|
it { is_expected.to validate_length_of(:reject_reason).is_at_most(500) }
|
||||||
|
end
|
||||||
|
|
||||||
describe ".create" do
|
describe ".create" do
|
||||||
fab!(:admin) { Fabricate(:admin) }
|
fab!(:admin) { Fabricate(:admin) }
|
||||||
fab!(:user) { Fabricate(:user) }
|
fab!(:user) { Fabricate(:user) }
|
||||||
|
|
Loading…
Reference in New Issue
Block a user