Progress with DMs
Progress with DMs
This commit is contained in:
@@ -4,22 +4,30 @@ class Api::V1::ChatConversations::ApprovedConversationsController < Api::BaseCon
|
||||
before_action -> { authorize_if_got_token! :read, :'read:chats' }
|
||||
|
||||
before_action :require_user!
|
||||
before_action :set_chat_conversation, only: :create
|
||||
after_action :insert_pagination_headers
|
||||
|
||||
def index
|
||||
puts "tilly ApprovedConversationsController-0"
|
||||
@chat_conversations = load_chat_conversations
|
||||
render json: @chat_conversations, each_serializer: REST::ChatConversationAccountSerializer
|
||||
end
|
||||
|
||||
def show
|
||||
puts "tilly ApprovedConversationsController-1"
|
||||
@chat_conversations = load_chat_conversations
|
||||
render json: @chat_conversations, each_serializer: REST::ChatConversationAccountSerializer
|
||||
render json: @chat_conversation, serializer: REST::ChatConversationAccountSerializer
|
||||
end
|
||||
|
||||
def unread_count
|
||||
# : todo : make is_unread into unread_count then count
|
||||
# count = ChatConversationAccount.where(account: current_account, is_hidden: false, is_approved: true, unread_count: true).count
|
||||
render json: 1
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_chat_conversation
|
||||
@chat_conversation = ChatConversationAccount.where(account: current_account).find(params[:id]).first
|
||||
end
|
||||
|
||||
def load_chat_conversations
|
||||
paginated_chat_conversations
|
||||
end
|
||||
|
||||
@@ -15,6 +15,22 @@ class Api::V1::ChatConversations::MessagesController < Api::BaseController
|
||||
render json: @chats, each_serializer: REST::ChatMessageSerializer
|
||||
end
|
||||
|
||||
def destroy_all
|
||||
puts "tilly destry all chat"
|
||||
# : todo :
|
||||
# check if is pro
|
||||
# @chat = ChatMessage.where(from_account: current_user.account).find(params[:id])
|
||||
|
||||
puts "tilly @chat: " + @chat.inspect
|
||||
|
||||
# : todo :
|
||||
# make sure last_chat_message_id in chat_account_conversation gets set to last
|
||||
|
||||
# @chat.destroy!
|
||||
|
||||
# render json: @chat, serializer: REST::ChatMessageSerializer
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_chat_conversation
|
||||
|
||||
Reference in New Issue
Block a user