fix: Standardize name validation on agent / profile pages (#1720)
This commit is contained in:
@@ -102,7 +102,7 @@ export default {
|
|||||||
validations: {
|
validations: {
|
||||||
agentName: {
|
agentName: {
|
||||||
required,
|
required,
|
||||||
minLength: minLength(4),
|
minLength: minLength(1),
|
||||||
},
|
},
|
||||||
agentEmail: {
|
agentEmail: {
|
||||||
required,
|
required,
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ export default {
|
|||||||
validations: {
|
validations: {
|
||||||
agentName: {
|
agentName: {
|
||||||
required,
|
required,
|
||||||
minLength: minLength(4),
|
minLength: minLength(1),
|
||||||
},
|
},
|
||||||
agentType: {
|
agentType: {
|
||||||
required,
|
required,
|
||||||
|
|||||||
@@ -136,6 +136,7 @@ export default {
|
|||||||
validations: {
|
validations: {
|
||||||
name: {
|
name: {
|
||||||
required,
|
required,
|
||||||
|
minLength: minLength(1),
|
||||||
},
|
},
|
||||||
displayName: {},
|
displayName: {},
|
||||||
email: {
|
email: {
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ class User < ApplicationRecord
|
|||||||
# validates_uniqueness_of :email, scope: :account_id
|
# validates_uniqueness_of :email, scope: :account_id
|
||||||
|
|
||||||
validates :email, :name, presence: true
|
validates :email, :name, presence: true
|
||||||
|
validates_length_of :name, minimum: 1
|
||||||
|
|
||||||
has_many :account_users, dependent: :destroy
|
has_many :account_users, dependent: :destroy
|
||||||
has_many :accounts, through: :account_users
|
has_many :accounts, through: :account_users
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ RSpec.describe User do
|
|||||||
context 'validations' do
|
context 'validations' do
|
||||||
it { is_expected.to validate_presence_of(:email) }
|
it { is_expected.to validate_presence_of(:email) }
|
||||||
it { is_expected.to validate_presence_of(:name) }
|
it { is_expected.to validate_presence_of(:name) }
|
||||||
|
it { is_expected.to validate_length_of(:name).is_at_least(1) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'associations' do
|
context 'associations' do
|
||||||
|
|||||||
Reference in New Issue
Block a user