Skip to content

Commit

Permalink
Merge branch 'MDL-64093_master' of git://github.com/markn86/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
abgreeve committed Feb 21, 2019
2 parents d4495e8 + 46014b8 commit df4a17c
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 4 deletions.
6 changes: 6 additions & 0 deletions admin/settings/subsystems.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
0)
);

$optionalsubsystems->add(new admin_setting_configcheckbox('messagingdefaultpressenter',
new lang_string('messagingdefaultpressenter', 'admin'),
new lang_string('configmessagingdefaultpressenter', 'admin'),
1)
);

$options = array(
DAYSECS => new lang_string('secondstotime86400'),
WEEKSECS => new lang_string('secondstotime604800'),
Expand Down
2 changes: 2 additions & 0 deletions lang/en/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@
$string['configmaxevents'] = 'Events to Lookahead';
$string['configmessaging'] = 'If enabled, users can send messages to other users on the site.';
$string['configmessagingallowemailoverride'] = 'Allow users to have email message notifications sent to an email address other than the email address in their profile';
$string['configmessagingdefaultpressenter'] = 'Whether \'Use enter to send\' is enabled by default in users\' messaging settings.';
$string['configmessagingdeletereadnotificationsdelay'] = 'Read notifications can be deleted to save space. How long after a notification is read can it be deleted?';
$string['configmessagingdeleteallnotificationsdelay'] = 'Read and unread notifications can be deleted to save space. How long after a notification is created can it be deleted?';
$string['configmessagingallusers'] = 'If enabled, users can view the list of all users on the site when selecting someone to message, and their message preferences include the option to accept messages from anyone on the site. If disabled, users can only view the list of users in their courses, and they have just two options in message preferences - to accept messages from their contacts only, or their contacts and anyone in their courses.';
Expand Down Expand Up @@ -772,6 +773,7 @@
$string['messaging'] = 'Enable messaging system';
$string['messagingallowemailoverride'] = 'Notification email override';
$string['messagingallusers'] = 'Allow site-wide messaging';
$string['messagingdefaultpressenter'] = 'Use enter to send enabled by default';
$string['messagingdeletereadnotificationsdelay'] = 'Delete read notifications';
$string['messagingdeleteallnotificationsdelay'] = 'Delete all notifications';
$string['minpassworddigits'] = 'Digits';
Expand Down
8 changes: 8 additions & 0 deletions lib/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2728,5 +2728,13 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2019021500.01);
}

if ($oldversion < 2019021500.02) {
// Default 'off' for existing sites as this is the behaviour they had earlier.
set_config('messagingdefaultpressenter', false);

// Main savepoint reached.
upgrade_main_savepoint(true, 2019021500.02);
}

return true;
}
6 changes: 4 additions & 2 deletions message/externallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -4160,7 +4160,7 @@ public static function get_user_message_preferences_parameters() {
* @since 3.2
*/
public static function get_user_message_preferences($userid = 0) {
global $PAGE;
global $CFG, $PAGE;

$params = self::validate_parameters(
self::get_user_message_preferences_parameters(),
Expand Down Expand Up @@ -4189,11 +4189,13 @@ public static function get_user_message_preferences($userid = 0) {

$renderer = $PAGE->get_renderer('core_message');

$entertosend = get_user_preferences('message_entertosend', $CFG->messagingdefaultpressenter, $user);

$result = array(
'warnings' => array(),
'preferences' => $notificationlistoutput->export_for_template($renderer),
'blocknoncontacts' => \core_message\api::get_user_privacy_messaging_preference($user->id),
'entertosend' => get_user_preferences('message_entertosend', false, $user)
'entertosend' => $entertosend
);
return $result;
}
Expand Down
2 changes: 1 addition & 1 deletion message/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ function core_message_standard_after_main_region_html() {
}

// Enter to send.
$entertosend = get_user_preferences('message_entertosend', false, $USER);
$entertosend = get_user_preferences('message_entertosend', $CFG->messagingdefaultpressenter, $USER);

return $renderer->render_from_template('core_message/message_drawer', [
'contactrequestcount' => $requestcount,
Expand Down
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

defined('MOODLE_INTERNAL') || die();

$version = 2019021500.01; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2019021500.02; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.

Expand Down

0 comments on commit df4a17c

Please sign in to comment.