MDL-65219 message: default disable contact request notifications for web

Set the default state to disabled for message contact request
notifications for the web process. The user is notified about contact
requests in the message drawer so it's unnecessary to also generate
a notification in the notification popover for them.
This commit is contained in:
Ryan Wyllie
2019-07-23 13:24:09 +08:00
parent 6cb33ce774
commit 5d61b3b331
3 changed files with 19 additions and 2 deletions
+2 -1
View File
@@ -121,7 +121,8 @@ $messageproviders = array (
// Message contact requests.
'messagecontactrequests' => [
'defaults' => [
'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_LOGGEDIN + MESSAGE_DEFAULT_LOGGEDOFF,
// We don't need to notify in the popup output here because the message drawer
// already notifies users of contact requests.
'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_LOGGEDOFF,
'airnotifier' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_LOGGEDIN + MESSAGE_DEFAULT_LOGGEDOFF,
]
+16
View File
@@ -3416,5 +3416,21 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2019070400.01);
}
if ($oldversion < 2019071800.01) {
// Remove the "popup" processor from the list of default processors for the messagecontactrequests notification.
$oldloggedinconfig = get_config('message', 'message_provider_moodle_messagecontactrequests_loggedin');
$oldloggedoffconfig = get_config('message', 'message_provider_moodle_messagecontactrequests_loggedoff');
$newloggedinconfig = implode(',', array_filter(explode(',', $oldloggedinconfig), function($value) {
return $value != 'popup';
}));
$newloggedoffconfig = implode(',', array_filter(explode(',', $oldloggedoffconfig), function($value) {
return $value != 'popup';
}));
set_config('message_provider_moodle_messagecontactrequests_loggedin', $newloggedinconfig, 'message');
set_config('message_provider_moodle_messagecontactrequests_loggedoff', $newloggedoffconfig, 'message');
upgrade_main_savepoint(true, 2019071800.01);
}
return true;
}
+1 -1
View File
@@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2019071800.00; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2019071800.01; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.