Merge branch 'hotfix/1.22.1' into develop

# Conflicts:
#	db/schema.rb
This commit is contained in:
Sojan
2021-11-22 23:35:44 +05:30
38 changed files with 211 additions and 95 deletions

View File

@@ -7,4 +7,10 @@ module Pubsubable
# Used by the actionCable/PubSub Service we use for real time communications
has_secure_token :pubsub_token
end
def pubsub_token
# backfills tokens for existing records
regenerate_pubsub_token if self[:pubsub_token].blank?
self[:pubsub_token]
end
end

View File

@@ -25,7 +25,7 @@
#
class Contact < ApplicationRecord
include Pubsubable
# TODO: remove the pubsub_token attribute from this model in future.
include Avatarable
include AvailabilityStatusable
include Labelable

View File

@@ -4,6 +4,7 @@
#
# id :bigint not null, primary key
# hmac_verified :boolean default(FALSE)
# pubsub_token :string
# created_at :datetime not null
# updated_at :datetime not null
# contact_id :bigint
@@ -15,6 +16,7 @@
# index_contact_inboxes_on_contact_id (contact_id)
# index_contact_inboxes_on_inbox_id (inbox_id)
# index_contact_inboxes_on_inbox_id_and_source_id (inbox_id,source_id) UNIQUE
# index_contact_inboxes_on_pubsub_token (pubsub_token) UNIQUE
# index_contact_inboxes_on_source_id (source_id)
#
# Foreign Keys
@@ -24,6 +26,7 @@
#
class ContactInbox < ApplicationRecord
include Pubsubable
validates :inbox_id, presence: true
validates :contact_id, presence: true
validates :source_id, presence: true