From f647b3f95b68a8f0af64e0a02acc3aac37a742df Mon Sep 17 00:00:00 2001 From: Dan Poltawski Date: Thu, 3 Jul 2014 15:18:39 +0100 Subject: [PATCH 1/2] MDL-43848 messages: do not display message content in popups The user is not in control of when these popups show up and it may not be appropiate to have part of this content display whilst in the presence of other users. --- lib/moodlelib.php | 38 +------------------------------------- 1 file changed, 1 insertion(+), 37 deletions(-) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index cc480f4..778fa68 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -8768,43 +8768,7 @@ function message_popup_window() { // If we have new messages to notify the user about. if (!empty($messageusers)) { - $strmessages = ''; - if (count($messageusers)>1) { - $strmessages = get_string('unreadnewmessages', 'message', count($messageusers)); - } else { - $messageusers = reset($messageusers); - - // Show who the message is from if its not a notification. - if (!$messageusers->notification) { - $strmessages = get_string('unreadnewmessage', 'message', fullname($messageusers) ); - } - - // Try to display the small version of the message. - $smallmessage = null; - if (!empty($messageusers->smallmessage)) { - // Display the first 200 chars of the message in the popup. - $smallmessage = null; - if (core_text::strlen($messageusers->smallmessage) > 200) { - $smallmessage = core_text::substr($messageusers->smallmessage, 0, 200).'...'; - } else { - $smallmessage = $messageusers->smallmessage; - } - - // Prevent html symbols being displayed. - if ($messageusers->fullmessageformat == FORMAT_HTML) { - $smallmessage = html_to_text($smallmessage); - } else { - $smallmessage = s($smallmessage); - } - } else if ($messageusers->notification) { - // Its a notification with no smallmessage so just say they have a notification. - $smallmessage = get_string('unreadnewnotification', 'message'); - } - if (!empty($smallmessage)) { - $strmessages .= '
'.s($smallmessage).'
'; - } - } - + $strmessages = get_string('unreadnewmessages', 'message', count($messageusers)); $strgomessage = get_string('gotomessages', 'message'); $strstaymessage = get_string('ignore', 'admin'); -- 1.9.2 From ca72c6d26b46877629ff1c16b62bd9578ca4b7fe Mon Sep 17 00:00:00 2001 From: Dan Poltawski Date: Fri, 4 Jul 2014 12:15:23 +0100 Subject: [PATCH 2/2] MDL-43848 message: remove unused strings --- lang/en/message.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/lang/en/message.php b/lang/en/message.php index ffe93e4..9dfcc56 100644 --- a/lang/en/message.php +++ b/lang/en/message.php @@ -141,8 +141,6 @@ $string['unblockcontact'] = 'Unblock contact'; $string['unreadmessages'] = 'Unread messages ({$a})'; $string['unreadnewmessages'] = 'New messages ({$a})'; $string['unreadnewmessage'] = 'New message from {$a}'; -$string['unreadnewnotification'] = 'New notification'; -$string['unreadnewnotifications'] = 'New notifications ({$a})'; $string['userisblockingyou'] = 'This user has blocked you from sending messages to them'; $string['userisblockingyounoncontact'] = '{$a} only accepts messages from their contacts.'; $string['userssearchresults'] = 'Users found: {$a}'; -- 1.9.2