MDL-83352 message: Update usercantbemessaged string

This commit is contained in:
Michael Hawkins 2024-10-03 13:43:08 +08:00 committed by Huong Nguyen
parent 54e9ee4a9e
commit b08fbf57fd
No known key found for this signature in database
GPG Key ID: 40D88AB693A3E72A
3 changed files with 5 additions and 5 deletions

View File

@ -263,7 +263,7 @@ $string['unreadnotifications'] = 'There are {$a} unread notifications';
$string['unreadnewgroupconversationmessage'] = 'New message from {$a->name} in {$a->conversationname}';
$string['unreadnewmessage'] = 'New message from {$a}';
$string['useentertosend'] = 'Use enter to send';
$string['usercantbemessaged'] = 'You can\'t message {$a} due to their message preferences. Try adding them as a contact.';
$string['usercantbemessaged'] = 'You can\'t message this user due to their message preferences. Try adding them as a contact.';
$string['userwouldliketocontactyou'] = '{$a} would like to contact you';
$string['viewfullnotification'] = 'View full notification';
$string['viewmessageswith'] = 'View messages with {$a}';

View File

@ -212,7 +212,7 @@ class core_message_external extends external_api {
// Check if the recipient can be messaged by the sender.
if ($success && !\core_message\api::can_send_message($tousers[$message['touserid']]->id, $USER->id)) {
$success = false;
$errormessage = get_string('usercantbemessaged', 'message', fullname(\core_user::get_user($message['touserid'])));
$errormessage = get_string('usercantbemessaged', 'message');
}
// Now we can send the message (at least try).

View File

@ -128,7 +128,7 @@ class externallib_test extends externallib_advanced_testcase {
$sentmessages = core_message_external::send_instant_messages($messages);
$sentmessages = external_api::clean_returnvalue(core_message_external::send_instant_messages_returns(), $sentmessages);
$this->assertEquals(
get_string('usercantbemessaged', 'message', fullname(\core_user::get_user($message1['touserid']))),
get_string('usercantbemessaged', 'message'),
array_pop($sentmessages)['errormessage']
);
@ -224,7 +224,7 @@ class externallib_test extends externallib_advanced_testcase {
$sentmessage = reset($sentmessages);
$this->assertEquals(get_string('usercantbemessaged', 'message', fullname($user2)), $sentmessage['errormessage']);
$this->assertEquals(get_string('usercantbemessaged', 'message'), $sentmessage['errormessage']);
$this->assertEquals(0, $DB->count_records('messages'));
}
@ -260,7 +260,7 @@ class externallib_test extends externallib_advanced_testcase {
$sentmessage = reset($sentmessages);
$this->assertEquals(get_string('usercantbemessaged', 'message', fullname($user2)), $sentmessage['errormessage']);
$this->assertEquals(get_string('usercantbemessaged', 'message'), $sentmessage['errormessage']);
$this->assertEquals(0, $DB->count_records('messages'));
}