Progress with DMs

Progress with DMs
This commit is contained in:
mgabdev
2020-12-03 17:13:11 -05:00
parent a129b3ce3b
commit 137a36b810
53 changed files with 539 additions and 182 deletions

View File

@@ -14,8 +14,6 @@
#
class AccountConversation < ApplicationRecord
after_commit :push_to_streaming_api
belongs_to :account
belongs_to :conversation
belongs_to :last_status, class_name: 'Status'
@@ -102,11 +100,6 @@ class AccountConversation < ApplicationRecord
self.last_status_id = status_ids.last
end
def push_to_streaming_api
return if destroyed? || !subscribed_to_timeline?
PushConversationWorker.perform_async(id)
end
def subscribed_to_timeline?
Redis.current.exists("subscribed:#{streaming_channel}")
end

View File

@@ -4,10 +4,10 @@
# Table name: chat_blocks
#
# id :bigint(8) not null, primary key
# account_id :integer not null
# target_account_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
# account_id :bigint(8) not null
# target_account_id :bigint(8) not null
#
class ChatBlock < ApplicationRecord

View File

@@ -3,16 +3,17 @@
#
# Table name: chat_conversation_accounts
#
# id :bigint(8) not null, primary key
# account_id :bigint(8)
# chat_conversation_id :bigint(8)
# participant_account_ids :bigint(8) default([]), not null, is an Array
# last_chat_message_id :bigint(8)
# is_unread :boolean default(FALSE), not null
# is_hidden :boolean default(FALSE), not null
# is_approved :boolean default(FALSE), not null
# created_at :datetime not null
# updated_at :datetime not null
# id :bigint(8) not null, primary key
# account_id :bigint(8)
# chat_conversation_id :bigint(8)
# participant_account_ids :bigint(8) default([]), not null, is an Array
# last_chat_message_id :bigint(8)
# is_hidden :boolean default(FALSE), not null
# is_approved :boolean default(FALSE), not null
# created_at :datetime not null
# updated_at :datetime not null
# unread_count :bigint(8) default(0), not null
# chat_message_expiration_policy :string
#
class ChatConversationAccount < ApplicationRecord
@@ -28,7 +29,6 @@ class ChatConversationAccount < ApplicationRecord
if participant_account_ids.empty?
[account]
else
# : todo : dont include current_account
participants = Account.where(id: participant_account_ids)
participants.empty? ? [account] : participants
end

View File

@@ -3,13 +3,14 @@
#
# Table name: chat_messages
#
# id :bigint(8) not null, primary key
# account_id :bigint(8) not null
# chat_conversation_id :bigint(8) not null
# text :text default(""), not null
# language :string
# created_at :datetime not null
# updated_at :datetime not null
# id :bigint(8) not null, primary key
# text :text default(""), not null
# language :text default(""), not null
# from_account_id :integer not null
# chat_conversation_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
# expires_at :datetime
#
class ChatMessage < ApplicationRecord

View File

@@ -3,11 +3,11 @@
#
# Table name: chat_mutes
#
# id :bigint(8) not null, primary key
# created_at :datetime not null
# updated_at :datetime not null
# account_id :bigint(8) not null
# target_account_id :bigint(8) not null
# id :bigint(8) not null, primary key
# account_id :integer not null
# target_account_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
#
class ChatMute < ApplicationRecord