MDL-63303 message: fix get_conversation_messages

This commit is contained in:
Ryan Wyllie 2018-11-05 14:13:54 +08:00
parent 9e189a914d
commit 32b4212e50
2 changed files with 9 additions and 10 deletions

View File

@ -1036,12 +1036,8 @@ class api {
}
}
$arrmessages = array();
if ($messages = helper::get_conversation_messages($userid, $convid, 0, $limitfrom, $limitnum, $sort, $timefrom, $timeto)) {
$arrmessages = helper::format_conversation_messages($userid, $convid, $messages);
}
return $arrmessages;
$messages = helper::get_conversation_messages($userid, $convid, 0, $limitfrom, $limitnum, $sort, $timefrom, $timeto);
return helper::format_conversation_messages($userid, $convid, $messages);
}
/**

View File

@ -218,10 +218,13 @@ class helper {
$memberids = array_unique(array_map(function($message) {
return $message->useridfrom;
}, $messages));
// Get members information.
$arrmembers = self::get_member_info($userid, $memberids);
// Add the members to the conversation.
$conversation['members'] = $arrmembers;
if (!empty($memberids)) {
// Get members information.
$conversation['members'] = self::get_member_info($userid, $memberids);
} else {
$conversation['members'] = array();
}
return $conversation;
}