Skip to content

Commit

Permalink
MDL-83352 message: Update usercantbemessaged string
Browse files Browse the repository at this point in the history
  • Loading branch information
mickhawkins authored and HuongNV13 committed Oct 3, 2024
1 parent f4202b2 commit f3189c1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lang/en/message.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@
$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}';
Expand Down
2 changes: 1 addition & 1 deletion message/externallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public static function send_instant_messages($messages = array()) {
// 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).
Expand Down
6 changes: 3 additions & 3 deletions message/tests/externallib_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public function test_send_instant_messages(): void {
$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']
);

Expand Down Expand Up @@ -225,7 +225,7 @@ public function test_send_instant_messages_blocked_user(): void {

$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'));
}
Expand Down Expand Up @@ -261,7 +261,7 @@ public function test_send_instant_messages_block_non_contacts(): void {

$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'));
}
Expand Down

0 comments on commit f3189c1

Please sign in to comment.