From 029c0fdb8521aca184e208ee4cc3020c66e3d909 Mon Sep 17 00:00:00 2001 From: Nicolas Dunand Date: Wed, 26 Sep 2018 08:50:10 +0200 Subject: [PATCH] MDL-63458 core_user: Remove send message if messaging is disabled --- message/tests/behat/message_admin_settings.feature | 9 +++++++++ user/index.php | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/message/tests/behat/message_admin_settings.feature b/message/tests/behat/message_admin_settings.feature index e482454439e..b7ae4849b48 100644 --- a/message/tests/behat/message_admin_settings.feature +++ b/message/tests/behat/message_admin_settings.feature @@ -8,6 +8,9 @@ Feature: Message admin settings Given the following "users" exist: | username | firstname | lastname | email | | user1 | User | One | one@example.com | + And the following "courses" exist: + | fullname | shortname | category | groupmode | + | Course 1 | C1 | 0 | 1 | Scenario: enable site messaging Given the following config values are set as admin: @@ -18,6 +21,9 @@ Feature: Message admin settings And I should see "User One" And I follow "User One" And "Add to contacts" "link" should exist + And I am on "Course 1" course homepage + And I navigate to course participants + And the "With selected users..." select box should contain "Send a message" Scenario: disable site messaging Given the following config values are set as admin: @@ -28,3 +34,6 @@ Feature: Message admin settings And I should see "User One" And I follow "User One" And "Add to contacts" "link" should not exist + And I am on "Course 1" course homepage + And I navigate to course participants + And the "With selected users..." select box should not contain "Send a message" diff --git a/user/index.php b/user/index.php index e7e05b22035..4e84da08771 100644 --- a/user/index.php +++ b/user/index.php @@ -292,7 +292,9 @@ if ($bulkoperations) { 'value' => get_string('deselectall'))); echo html_writer::end_tag('div'); $displaylist = array(); - $displaylist['#messageselect'] = get_string('messageselectadd'); + if (!empty($CFG->messaging)) { + $displaylist['#messageselect'] = get_string('messageselectadd'); + } if (!empty($CFG->enablenotes) && has_capability('moodle/notes:manage', $context) && $context->id != $frontpagectx->id) { $displaylist['#addgroupnote'] = get_string('addnewnote', 'notes'); }