This commit is contained in:
mgabdev
2020-12-15 19:31:30 -05:00
parent de0c977950
commit 75d52c841e
129 changed files with 2559 additions and 910 deletions

View File

@@ -17,15 +17,26 @@
#
# : todo : expires
# : todo : max per account
class ChatConversationAccount < ApplicationRecord
include Paginable
PER_ACCOUNT_APPROVED_LIMIT = 100
EXPIRATION_POLICY_MAP = {
none: nil,
five_minutes: '1',
sixty_minutes: '2',
six_hours: '3',
one_day: '4',
three_days: '5',
one_week: '6',
}.freeze
belongs_to :account
belongs_to :chat_conversation
belongs_to :last_chat_message, class_name: 'ChatMessage', optional: true
# before_validation :set_last_chat_message
def participant_accounts
if participant_account_ids.empty?
[account]
@@ -35,10 +46,4 @@ class ChatConversationAccount < ApplicationRecord
end
end
private
def set_last_chat_message
self.last_chat_message_id = nil # : todo :
end
end