From 142b042c5ccaa537fb2a59c4773326ac4d1064e6 Mon Sep 17 00:00:00 2001 From: Ryan Wyllie Date: Tue, 16 Oct 2018 11:53:32 +0800 Subject: [PATCH] MDL-63303 message: message/index.php open conversation in message drawer --- message/index.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/message/index.php b/message/index.php index 159ebfbb204..c50e881f6e0 100644 --- a/message/index.php +++ b/message/index.php @@ -99,6 +99,25 @@ $usernode->remove(); $settings = $PAGE->settingsnav->find('messages', null); $settings->make_active(); +if ($currentuser) { + // We're in the pprocess of deprecating this page however we haven't replaced the functionality + // for the admin (or user with correct capabilities) to view other user's conversations. For the + // time being this page will simply open the message drawer unless it's the admin user case just + // mentioned. In that case we will render the old UI for backwards compatibility. + echo $OUTPUT->header(); + echo $OUTPUT->heading(get_string('messages', 'message')); + $conversationid = empty($user2id) ? null : \core_message\api::get_conversation_between_users([$USER->id, $user2id]); + if (empty($conversationid)) { + $PAGE->requires->js_call_amd('core_message/message_drawer_helper', 'show'); + } else { + $PAGE->requires->js_call_amd('core_message/message_drawer_helper', 'showConversation', [$conversationid]); + } + echo $OUTPUT->footer(); + exit(); +} + +// The only time we should get here is if it's an admin type user viewing another user's messages. + // Get the renderer and the information we are going to be use. $renderer = $PAGE->get_renderer('core_message'); $requestedconversation = false; -- 2.11.4.GIT