Fix "presence" checks in Channel::TwilioSms (#5206)

This commit is contained in:
Jordan Brough 2022-10-06 22:52:33 -06:00 committed by GitHub
parent 788b766179
commit ce7d9be633
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,8 +28,8 @@ class Channel::TwilioSms < ApplicationRecord
validates :auth_token, presence: true validates :auth_token, presence: true
# Must have _one_ of messaging_service_sid _or_ phone_number, and messaging_service_sid is preferred # Must have _one_ of messaging_service_sid _or_ phone_number, and messaging_service_sid is preferred
validates :messaging_service_sid, uniqueness: true, presence: true, unless: :phone_number.presence validates :messaging_service_sid, uniqueness: true, presence: true, unless: :phone_number?
validates :phone_number, absence: true, if: :messaging_service_sid.presence validates :phone_number, absence: true, if: :messaging_service_sid?
validates :phone_number, uniqueness: true, allow_nil: true validates :phone_number, uniqueness: true, allow_nil: true
enum medium: { sms: 0, whatsapp: 1 } enum medium: { sms: 0, whatsapp: 1 }