Progress
Albums almost done, group, chat moderation, photo, video page updates
This commit is contained in:
@@ -19,13 +19,6 @@ class Api::V1::ChatConversationController < Api::BaseController
|
||||
end
|
||||
|
||||
def create
|
||||
# : todo :
|
||||
# check if already created
|
||||
# check if blocked
|
||||
# check if chat blocked
|
||||
# check if allow anyone to message then create with approved:true
|
||||
# unique account id, participants
|
||||
|
||||
chat_conversation_account = find_or_create_conversation
|
||||
render json: chat_conversation_account, each_serializer: REST::ChatConversationAccountSerializer
|
||||
end
|
||||
@@ -80,26 +73,8 @@ class Api::V1::ChatConversationController < Api::BaseController
|
||||
|
||||
def find_or_create_conversation
|
||||
chat = ChatConversationAccount.find_by(account: current_account, participant_account_ids: [@account.id.to_s])
|
||||
|
||||
return chat unless chat.nil?
|
||||
|
||||
chat_conversation = ChatConversation.create
|
||||
|
||||
my_chat = ChatConversationAccount.create!(
|
||||
account: current_account,
|
||||
participant_account_ids: [@account.id.to_s],
|
||||
chat_conversation: chat_conversation,
|
||||
is_approved: true
|
||||
)
|
||||
|
||||
# : todo : if multiple ids
|
||||
their_chat = ChatConversationAccount.create!(
|
||||
account: @account,
|
||||
participant_account_ids: [current_account.id.to_s],
|
||||
chat_conversation: chat_conversation,
|
||||
is_approved: false # default as request
|
||||
)
|
||||
|
||||
my_chat = CreateChatConversationService.new.call(current_account, [@account])
|
||||
return my_chat
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user