mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-19 09:36:47 +10:00
Merge branch 'rs-abuse-report-validation' into 'master'
Use a more sensible message for the AbuseReport uniqueness validation Previously it was "user has already been taken", when really we were saying the user has already been reported. See merge request !2461
This commit is contained in:
@@ -17,7 +17,7 @@ class AbuseReport < ActiveRecord::Base
|
||||
validates :reporter, presence: true
|
||||
validates :user, presence: true
|
||||
validates :message, presence: true
|
||||
validates :user_id, uniqueness: true
|
||||
validates :user_id, uniqueness: { message: 'has already been reported' }
|
||||
|
||||
def remove_user
|
||||
user.block
|
||||
|
||||
@@ -26,7 +26,7 @@ RSpec.describe AbuseReport, type: :model do
|
||||
it { is_expected.to validate_presence_of(:reporter) }
|
||||
it { is_expected.to validate_presence_of(:user) }
|
||||
it { is_expected.to validate_presence_of(:message) }
|
||||
it { is_expected.to validate_uniqueness_of(:user_id) }
|
||||
it { is_expected.to validate_uniqueness_of(:user_id).with_message('has already been reported') }
|
||||
end
|
||||
|
||||
describe '#remove_user' do
|
||||
|
||||
Reference in New Issue
Block a user