Skip to content

Commit

Permalink
MDL-55770 core_message: remove the send message pop-up
Browse files Browse the repository at this point in the history
Revert "MDL-48933 core_message: New dialog to send a message to a user"
Revert "MDL-48933 core_message: Behat tests to cover messenger dialogs"
  • Loading branch information
mdjnelson committed Oct 7, 2016
1 parent 5bf0ff2 commit 658d0b2
Show file tree
Hide file tree
Showing 16 changed files with 4 additions and 2,261 deletions.
8 changes: 2 additions & 6 deletions blocks/online_users/block_online_users.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function has_config() {
}

function get_content() {
global $USER, $CFG, $DB, $OUTPUT, $PAGE;
global $USER, $CFG, $DB, $OUTPUT;

if ($this->content !== NULL) {
return $this->content;
Expand Down Expand Up @@ -106,7 +106,6 @@ function get_content() {
if (isloggedin() && has_capability('moodle/site:sendmessage', $this->page->context)
&& !empty($CFG->messaging) && !isguestuser()) {
$canshowicon = true;
message_messenger_requirejs();
} else {
$canshowicon = false;
}
Expand All @@ -126,10 +125,7 @@ function get_content() {
if ($canshowicon and ($USER->id != $user->id) and !isguestuser($user)) { // Only when logged in and messaging active etc
$anchortagcontents = '<img class="iconsmall" src="'.$OUTPUT->pix_url('t/message') . '" alt="'. get_string('messageselectadd') .'" />';
$anchorurl = new moodle_url('/message/index.php', array('id' => $user->id));
$anchortag = html_writer::link($anchorurl, $anchortagcontents, array_merge(
message_messenger_sendmessage_link_params($user),
array('title' => get_string('messageselectadd'))
));
$anchortag = html_writer::link($anchorurl, $anchortagcontents, array('title' => get_string('messageselectadd')));

$this->content->text .= '<div class="message">'.$anchortag.'</div>';
}
Expand Down
4 changes: 0 additions & 4 deletions lang/en/message.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
$string['emptysearchstring'] = 'You must search for something';
$string['enabled'] = 'Enabled';
$string['errorcallingprocessor'] = 'Error calling defined output';
$string['errorwhilesendingmessage'] = 'An error occurred while sending the message; please try again later.';
$string['errortranslatingdefault'] = 'Error translating default setting provided by plugin, using system defaults instead.';
$string['eventmessagecontactadded'] = 'Message contact added';
$string['eventmessagecontactblocked'] = 'Message contact blocked';
Expand Down Expand Up @@ -99,11 +98,9 @@
$string['messagehistory'] = 'Message history';
$string['messagehistoryfull'] = 'All messages';
$string['messagenavigation'] = 'Message navigation:';
$string['messagetosend'] = 'Message to send';
$string['messagepreferences'] = 'Message preferences';
$string['messageprocessors'] = 'Message processors';
$string['messages'] = 'Messages';
$string['messagesent'] = 'Message sent';
$string['messaging'] = 'Messaging';
$string['messagingblockednoncontact'] = '{$a} will not be able to reply as you have blocked non-contacts';
$string['messagingdisabled'] = 'Messaging is disabled on this site, emails will be sent instead';
Expand Down Expand Up @@ -160,7 +157,6 @@
$string['send'] = 'Send';
$string['sendingvia'] = 'Sending "{$a->provider}" via "{$a->processor}"';
$string['sendingviawhen'] = 'Sending "{$a->provider}" via "{$a->processor}" when {$a->state}';
$string['sendingmessage'] = 'Sending message';
$string['sendmessage'] = 'Send message';
$string['sendmessageto'] = 'Send message to {$a}';
$string['sendmessagetopopup'] = 'Send message to {$a} - new window';
Expand Down
6 changes: 2 additions & 4 deletions lib/outputrenderers.php
Original file line number Diff line number Diff line change
Expand Up @@ -4163,7 +4163,7 @@ public function context_header($headerinfo = null, $headinglevel = 1) {
'title' => get_string('message', 'message'),
'url' => new moodle_url('/message/index.php', array('id' => $user->id)),
'image' => 'message',
'linkattributes' => message_messenger_sendmessage_link_params($user),
'linkattributes' => array('role' => 'button'),
'page' => $this->page
),
'togglecontact' => array(
Expand Down Expand Up @@ -4237,9 +4237,7 @@ protected function render_context_header(context_header $contextheader) {
foreach ($contextheader->additionalbuttons as $button) {
if (!isset($button->page)) {
// Include js for messaging.
if ($button['buttontype'] === 'message') {
message_messenger_requirejs();
} else if ($button['buttontype'] === 'togglecontact') {
if ($button['buttontype'] === 'togglecontact') {
message_togglecontact_requirejs();
}
$image = $this->pix_icon($button['formattedimage'], $button['title'], 'moodle', array(
Expand Down
82 changes: 0 additions & 82 deletions message/ajax.php

This file was deleted.

58 changes: 0 additions & 58 deletions message/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1972,41 +1972,6 @@ function message_count_unread_popup_notifications($useridto = 0) {
);
}

/**
* Requires the JS libraries to send a message using a dialog.
*
* @return void
*/
function message_messenger_requirejs() {
global $PAGE;

static $done = false;
if ($done) {
return;
}

$PAGE->requires->yui_module(
array('moodle-core_message-messenger'),
'Y.M.core_message.messenger.init',
array(array())
);
$PAGE->requires->strings_for_js(array(
'errorwhilesendingmessage',
'messagesent',
'messagetosend',
'sendingmessage',
'sendmessage',
'viewconversation',
), 'core_message');
$PAGE->requires->strings_for_js(array(
'userisblockingyou',
'userisblockingyounoncontact'
), 'message');
$PAGE->requires->string_for_js('error', 'core');

$done = true;
}

/**
* Requires the JS libraries for the toggle contact button.
*
Expand All @@ -2024,29 +1989,6 @@ function message_togglecontact_requirejs() {
$done = true;
}

/**
* Returns the attributes to place on a link to open the 'Send message' dialog.
*
* @param object $user User object.
* @return void
*/
function message_messenger_sendmessage_link_params($user) {
$params = array(
'data-trigger' => 'core_message-messenger::sendmessage',
'data-fullname' => fullname($user),
'data-userid' => $user->id,
'role' => 'button'
);

if (message_is_user_non_contact_blocked($user)) {
$params['data-blocked-string'] = 'userisblockingyounoncontact';
} else if (message_is_user_blocked($user)) {
$params['data-blocked-string'] = 'userisblockingyou';
}

return $params;
}

/**
* Returns the attributes to place on a contact button.
*
Expand Down
71 changes: 0 additions & 71 deletions message/tests/behat/send_message.feature

This file was deleted.

Loading

0 comments on commit 658d0b2

Please sign in to comment.