feat: Ability to edit a contact (#1092)

Ability to edit contact information in conversation sidebar

Co-authored-by: Sojan <sojan@pepalo.com>
This commit is contained in:
Pranav Raj S
2020-08-23 00:05:07 +05:30
committed by GitHub
parent ec6cd4bbba
commit 8cf05f1d9f
23 changed files with 709 additions and 133 deletions

View File

@@ -38,7 +38,7 @@ class Contact < ApplicationRecord
has_many :inboxes, through: :contact_inboxes
has_many :messages, as: :sender, dependent: :destroy
before_validation :downcase_email
before_validation :prepare_email_attribute
after_create_commit :dispatch_create_event
after_update_commit :dispatch_update_event
@@ -69,9 +69,9 @@ class Contact < ApplicationRecord
}
end
private
def downcase_email
def prepare_email_attribute
# So that the db unique constraint won't throw error when email is ''
self.email = nil if email.blank?
email.downcase! if email.present?
end