Returns conversations messages

This commit is contained in:
Pierre 2018-05-27 11:39:21 +02:00
parent 9e85b25c1a
commit ce92bb04b2
2 changed files with 19 additions and 4 deletions

View File

@ -298,14 +298,20 @@ class accountController {
foreach($data["movies"] as $num => $movie) foreach($data["movies"] as $num => $movie)
$data["movies"][$num] = MoviesController::MovieToAPI($movie); $data["movies"][$num] = MoviesController::MovieToAPI($movie);
//Conversations messages //All conversations messages from user
foreach($data["conversation_messages"] as $num => $message) foreach($data["all_conversation_messages"] as $num => $message)
$data["conversation_messages"][$num] = ConversationsController::ConvMessageToAPI($message); $data["all_conversation_messages"][$num] = ConversationsController::ConvMessageToAPI($message);
//Conversations list //Conversations list
foreach($data["conversations_list"] as $num => $conversation) foreach($data["conversations_list"] as $num => $conversation)
$data["conversations_list"][$num] = ConversationsController::ConvInfoToAPI($conversation); $data["conversations_list"][$num] = ConversationsController::ConvInfoToAPI($conversation);
//Conversation messages
foreach($data["conversations_messages"] as $convID=>$messages){
foreach($messages as $num=>$message)
$data["conversations_messages"][$convID][$num] = ConversationsController::ConvMessageToAPI($message);
}
//Friends list //Friends list
foreach($data["friends_list"] as $num => $friend) foreach($data["friends_list"] as $num => $friend)
$data["friends_list"][$num] = friendsController::parseFriendAPI($friend); $data["friends_list"][$num] = friendsController::parseFriendAPI($friend);

View File

@ -393,11 +393,20 @@ class AccountComponent {
$data["movies"] = components()->movies->get_list($userID); $data["movies"] = components()->movies->get_list($userID);
//Conversation messages //Conversation messages
$data["conversation_messages"] = components()->conversations->getAllUserMessages($userID); $data["all_conversation_messages"] = components()->conversations->getAllUserMessages($userID);
//Conversations list //Conversations list
$data["conversations_list"] = components()->conversations->getList($userID); $data["conversations_list"] = components()->conversations->getList($userID);
//Conversation messages
$data["conversations_messages"] = array();
foreach($data["conversations_list"] as $conversation)
//Get all the messages of the conversation
$data["conversations_messages"][$conversation->get_ID()] =
components()->conversations->getAllMessages($conversation->get_ID());
//Friend list //Friend list
$data["friends_list"] = components()->friends->getList($userID); $data["friends_list"] = components()->friends->getList($userID);