diff --git a/admin/tool/dataprivacy/db/messages.php b/admin/tool/dataprivacy/db/messages.php index 25f3a7f140a..ce2e0ca384a 100644 --- a/admin/tool/dataprivacy/db/messages.php +++ b/admin/tool/dataprivacy/db/messages.php @@ -45,6 +45,7 @@ $messageproviders = [ // Notify Data Protection Officer about exceptions. 'notifyexceptions' => [ 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, ], 'capability' => 'tool/dataprivacy:managedatarequests' diff --git a/admin/tool/messageinbound/db/messages.php b/admin/tool/messageinbound/db/messages.php index 38d35caf085..61b783c0d87 100644 --- a/admin/tool/messageinbound/db/messages.php +++ b/admin/tool/messageinbound/db/messages.php @@ -24,11 +24,26 @@ $messageproviders = array ( // Invalid recipient handler. - 'invalidrecipienthandler' => array(), + 'invalidrecipienthandler' => [ + 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + ], + ], // A generic message processing error. - 'messageprocessingerror' => array(), + 'messageprocessingerror' => [ + 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + ], + ], // A generic message processing success message. - 'messageprocessingsuccess' => array(), + 'messageprocessingsuccess' => [ + 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + ], + ], ); diff --git a/admin/tool/monitor/db/messages.php b/admin/tool/monitor/db/messages.php index e80f6ef2d2c..0a55e9adb12 100644 --- a/admin/tool/monitor/db/messages.php +++ b/admin/tool/monitor/db/messages.php @@ -27,6 +27,10 @@ defined('MOODLE_INTERNAL') || die(); $messageproviders = array ( // Notify a user that a rule has happened. 'notification' => array ( + 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + ], 'capability' => 'tool/monitor:subscribe' ) ); diff --git a/admin/tool/monitor/tests/behat/subscription.feature b/admin/tool/monitor/tests/behat/subscription.feature index 3cc5765080a..41aa1c39901 100644 --- a/admin/tool/monitor/tests/behat/subscription.feature +++ b/admin/tool/monitor/tests/behat/subscription.feature @@ -102,10 +102,6 @@ Feature: tool_monitor_subscriptions Scenario: Receiving notification on site level Given I log in as "admin" And I follow "Preferences" in the user menu - And I click on "Notification preferences" "link" in the "#page-content" "css_element" - And I click on "//td[@data-processor-name='popup']//div[@class='preference-state']" "xpath_element" in the "Notifications of rule subscriptions" "table_row" - And I wait until the page is ready - And I follow "Preferences" in the user menu And I follow "Event monitoring" And I set the field "Select a course" to "Acceptance test site" And I follow "Subscribe to rule \"New rule site level\"" @@ -123,10 +119,6 @@ Feature: tool_monitor_subscriptions Scenario: Receiving notification on course level Given I log in as "teacher1" And I follow "Preferences" in the user menu - And I click on "Notification preferences" "link" in the "#page-content" "css_element" - And I click on "//td[@data-processor-name='popup']//div[@class='preference-state']" "xpath_element" in the "Notifications of rule subscriptions" "table_row" - And I wait until the page is ready - And I follow "Preferences" in the user menu And I follow "Event monitoring" And I set the field "Select a course" to "Course 1" And I follow "Subscribe to rule \"New rule course level\"" diff --git a/enrol/flatfile/db/messages.php b/enrol/flatfile/db/messages.php index 6df345913d8..03f7bb88ef5 100644 --- a/enrol/flatfile/db/messages.php +++ b/enrol/flatfile/db/messages.php @@ -25,5 +25,10 @@ defined('MOODLE_INTERNAL') || die(); $messageproviders = array( - 'flatfile_enrolment' => array(), + 'flatfile_enrolment' => [ + 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + ], + ], ); diff --git a/enrol/imsenterprise/db/messages.php b/enrol/imsenterprise/db/messages.php index d75d42436f2..1b7ad1d3b67 100644 --- a/enrol/imsenterprise/db/messages.php +++ b/enrol/imsenterprise/db/messages.php @@ -25,5 +25,10 @@ defined('MOODLE_INTERNAL') || die(); $messageproviders = array( - 'imsenterprise_enrolment' => array(), + 'imsenterprise_enrolment' => [ + 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + ], + ], ); diff --git a/enrol/manual/db/messages.php b/enrol/manual/db/messages.php index a576217c0e4..6d116ad8fbf 100644 --- a/enrol/manual/db/messages.php +++ b/enrol/manual/db/messages.php @@ -24,6 +24,11 @@ $messageproviders = array ( - 'expiry_notification' => array(), + 'expiry_notification' => [ + 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + ], + ], ); diff --git a/enrol/paypal/db/messages.php b/enrol/paypal/db/messages.php index c079e87d1d5..cc94c5f52b5 100644 --- a/enrol/paypal/db/messages.php +++ b/enrol/paypal/db/messages.php @@ -25,5 +25,10 @@ defined('MOODLE_INTERNAL') || die(); $messageproviders = array( - 'paypal_enrolment' => array(), + 'paypal_enrolment' => [ + 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + ], + ], ); diff --git a/enrol/self/db/messages.php b/enrol/self/db/messages.php index 6f53d0c2a68..0e1fa9ad340 100644 --- a/enrol/self/db/messages.php +++ b/enrol/self/db/messages.php @@ -24,6 +24,11 @@ $messageproviders = array ( - 'expiry_notification' => array(), + 'expiry_notification' => [ + 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + ], + ], ); diff --git a/lib/db/messages.php b/lib/db/messages.php index 0c8a68209bb..56b67ecd630 100644 --- a/lib/db/messages.php +++ b/lib/db/messages.php @@ -36,29 +36,38 @@ defined('MOODLE_INTERNAL') || die(); $messageproviders = array ( 'newlogin' => array ( - 'defaults' => array( + 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, 'airnotifier' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, - ), + ], ), - // Notices that an admin might be interested in + // Notices that an admin might be interested in. 'notices' => array ( - 'capability' => 'moodle/site:config' + 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + ], + 'capability' => 'moodle/site:config', ), - // Important errors that an admin ought to know about + // Important errors that an admin ought to know about. 'errors' => array ( - 'capability' => 'moodle/site:config' + 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + ], + 'capability' => 'moodle/site:config', ), - // cron-based notifications about available moodle and/or additional plugin updates + // Cron-based notifications about available moodle and/or additional plugin updates. 'availableupdate' => array( + 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + ], 'capability' => 'moodle/site:config', - 'defaults' => array( - 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED - ), - ), 'instantmessage' => array ( @@ -69,33 +78,47 @@ $messageproviders = array ( ), 'backup' => array ( + 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + ], 'capability' => 'moodle/site:config' ), // Course creation request notification 'courserequested' => array ( + 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + ], 'capability' => 'moodle/site:approvecourse' ), - // Course request approval notification + // Course request approval notification. 'courserequestapproved' => array ( - 'capability' => 'moodle/course:request', - 'defaults' => array( + 'capability' => 'moodle/course:request', + 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, 'airnotifier' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, - ), + ], ), - // Course request rejection notification + // Course request rejection notification. 'courserequestrejected' => array ( 'capability' => 'moodle/course:request', - 'defaults' => array( + 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, 'airnotifier' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, - ), + ], ), // Course completed. Requires course completion configured at course level. It does not work with just activity progress. 'coursecompleted' => [ 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, 'airnotifier' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, ], ], @@ -121,16 +144,27 @@ $messageproviders = array ( // Badge award notification to a badge creator (mostly cron-based). 'badgecreatornotice' => array ( - 'defaults' => array( + 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, - ) + ], ), // A comment was left on a plan. - 'competencyplancomment' => array(), + 'competencyplancomment' => [ + 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + ], + ], // A comment was left on a user competency. - 'competencyusercompcomment' => array(), + 'competencyusercompcomment' => [ + 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + ], + ], // User insights. 'insights' => array ( @@ -168,12 +202,17 @@ $messageproviders = array ( // Infected files. 'infected' => array( + 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + ], 'capability' => 'moodle/site:config', ), // Report builder schedules. 'reportbuilderschedule' => [ 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, 'email' => MESSAGE_FORCED, ], ], diff --git a/mod/assign/db/messages.php b/mod/assign/db/messages.php index 04e66a1715a..d298e9d2879 100644 --- a/mod/assign/db/messages.php +++ b/mod/assign/db/messages.php @@ -25,7 +25,11 @@ $messageproviders = array ( // Ordinary assignment submissions. - 'assign_notification' => array( - ) + 'assign_notification' => [ + 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + ], + ], ); diff --git a/mod/assign/tests/behat/submission_notifications.feature b/mod/assign/tests/behat/submission_notifications.feature index fe2de57133c..96ebdf088d7 100644 --- a/mod/assign/tests/behat/submission_notifications.feature +++ b/mod/assign/tests/behat/submission_notifications.feature @@ -9,6 +9,9 @@ Feature: Manage assignment submission web notifications | username | firstname | lastname | email | | student1 | Student | 1 | student1@example.com | | teacher1 | Teacher | 1 | teacher1@example.com | + And the following "user preferences" exist: + | user | preference | value | + | teacher1 | message_provider_mod_assign_assign_notification_enabled | none | And the following "courses" exist: | fullname | shortname | category | | Course 1 | C1 | 0 | diff --git a/mod/bigbluebuttonbn/db/messages.php b/mod/bigbluebuttonbn/db/messages.php index f19c13df81c..9a0b162b157 100644 --- a/mod/bigbluebuttonbn/db/messages.php +++ b/mod/bigbluebuttonbn/db/messages.php @@ -28,12 +28,16 @@ $messageproviders = [ // Recording ready notification posts. 'recording_ready' => [ 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, ], ], // The instance was created or updated. 'instance_updated' => [ 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, ], ], ]; diff --git a/mod/feedback/db/messages.php b/mod/feedback/db/messages.php index 28c1d894612..af9096d0edb 100644 --- a/mod/feedback/db/messages.php +++ b/mod/feedback/db/messages.php @@ -24,11 +24,19 @@ $messageproviders = array ( -/// Submitting a feedback - 'submission' => array ( - ), -/// Message to nonrespondents - 'message' => array ( - ) + // Submitting a feedback. + 'submission' => [ + 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + ], + ], + // Message to nonrespondents. + 'message' => [ + 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + ], + ], ); diff --git a/mod/forum/db/messages.php b/mod/forum/db/messages.php index 3b7182b59b9..2be7be78245 100644 --- a/mod/forum/db/messages.php +++ b/mod/forum/db/messages.php @@ -26,12 +26,18 @@ $messageproviders = array ( // Ordinary single forum posts. 'posts' => array( - 'defaults' => array( + 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, 'airnotifier' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, - ), + ], ), // Forum digest messages. - 'digests' => array( - ), + 'digests' => [ + 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + ], + ], ); diff --git a/mod/lesson/db/messages.php b/mod/lesson/db/messages.php index f90da13dc71..cbb9e09086a 100644 --- a/mod/lesson/db/messages.php +++ b/mod/lesson/db/messages.php @@ -25,11 +25,13 @@ $messageproviders = array ( - // essay graded notification + // Essay graded notification. 'graded_essay' => array ( - 'defaults' => array( + 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, 'airnotifier' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, - ), + ], ) ); diff --git a/mod/quiz/db/messages.php b/mod/quiz/db/messages.php index 39bede29c94..5c0a48cd4aa 100644 --- a/mod/quiz/db/messages.php +++ b/mod/quiz/db/messages.php @@ -27,13 +27,19 @@ defined('MOODLE_INTERNAL') || die(); $messageproviders = [ // Notify teacher that a student has submitted a quiz attempt. 'submission' => [ - 'capability' => 'mod/quiz:emailnotifysubmission' + 'capability' => 'mod/quiz:emailnotifysubmission', + 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + ], ], // Confirm a student's quiz attempt. 'confirmation' => [ 'capability' => 'mod/quiz:emailconfirmsubmission', 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, 'airnotifier' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, ], ], @@ -43,6 +49,8 @@ $messageproviders = [ 'attempt_overdue' => [ 'capability' => 'mod/quiz:emailwarnoverdue', 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, 'airnotifier' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, ], ], @@ -50,6 +58,8 @@ $messageproviders = [ 'attempt_grading_complete' => [ 'capability' => 'mod/quiz:emailnotifyattemptgraded', 'defaults' => [ + 'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, + 'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, 'airnotifier' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED, ], ],