MDL-63898 core_message: fix for get_conversations message formatting

This used to return a text version of the message, but needs to return
the message formatted with message_format_message_text().
This commit is contained in:
Jake Dallimore
2018-11-07 14:23:54 +08:00
parent 08c51ff080
commit 74fc14e5b2
4 changed files with 90 additions and 17 deletions
+3 -2
View File
@@ -386,7 +386,8 @@ class api {
$typesql = !is_null($type) ? " AND mc.type = :convtype " : "";
$sql = "SELECT m.id as messageid, mc.id as id, mc.name as conversationname, mc.type as conversationtype, m.useridfrom,
m.smallmessage, m.timecreated, mc.component, mc.itemtype, mc.itemid
m.smallmessage, m.fullmessage, m.fullmessageformat, m.fullmessagehtml, m.timecreated, mc.component,
mc.itemtype, mc.itemid
FROM {message_conversations} mc
INNER JOIN {message_conversation_members} mcm
ON (mcm.conversationid = mc.id AND mcm.userid = :userid3)
@@ -568,7 +569,7 @@ class api {
if ($conversation->smallmessage) {
$msg = new \stdClass();
$msg->id = $conversation->messageid;
$msg->text = clean_param($conversation->smallmessage, PARAM_NOTAGS);
$msg->text = message_format_message_text($conversation);
$msg->useridfrom = $conversation->useridfrom;
$msg->timecreated = $conversation->timecreated;
$conv->messages[] = $msg;