mirror of
https://github.com/moodle/moodle.git
synced 2025-01-29 19:50:14 +01:00
MDL-68465 message_email: Add site name to digest email
This commit is contained in:
parent
9df4a4de18
commit
1f7e9a698a
@ -57,7 +57,7 @@ class send_email_task extends scheduled_task {
|
||||
* Send out emails.
|
||||
*/
|
||||
public function execute() {
|
||||
global $DB, $PAGE;
|
||||
global $DB, $PAGE, $SITE;
|
||||
|
||||
// Get the maximum id we are going to use.
|
||||
// We use this as records may be added to the table while this task runs.
|
||||
@ -91,7 +91,7 @@ class send_email_task extends scheduled_task {
|
||||
}
|
||||
$conversations->close();
|
||||
if ($hascontent) {
|
||||
$subject = get_string('emaildigestsubject', 'message_email');
|
||||
$subject = get_string('messagedigestemailsubject', 'message_email', format_string($SITE->fullname));
|
||||
$message = $textrenderer->render($renderable);
|
||||
$messagehtml = $htmlrenderer->render($renderable);
|
||||
if (email_to_user($user, $noreplyuser, $subject, $message, $messagehtml)) {
|
||||
|
@ -28,6 +28,7 @@ $string['emaildigestunreadmessages'] = 'Unread messages';
|
||||
$string['emaildigestviewallmessages'] = 'View all messages';
|
||||
$string['emailonlyfromnoreplyaddress'] = 'Always send email from the no-reply address?';
|
||||
$string['ifemailleftempty'] = 'Leave empty to send notifications to {$a}';
|
||||
$string['messagedigestemailsubject'] = '{$a}: Messages digest';
|
||||
$string['pluginname'] = 'Email';
|
||||
$string['privacy:metadata:attachment'] = 'A file on the filesystem.';
|
||||
$string['privacy:metadata:attachname'] = 'The name of the attached file (extension indicates MIME).';
|
||||
|
@ -43,7 +43,7 @@ class core_message_send_email_task_testcase extends advanced_testcase {
|
||||
* Test sending email task.
|
||||
*/
|
||||
public function test_sending_email_task() {
|
||||
global $DB;
|
||||
global $DB, $SITE;
|
||||
|
||||
$this->preventResetByRollback(); // Messaging is not compatible with transactions.
|
||||
|
||||
@ -122,7 +122,8 @@ class core_message_send_email_task_testcase extends advanced_testcase {
|
||||
// Confirm it contains the correct data.
|
||||
$emails = $sink->get_messages();
|
||||
$email = reset($emails);
|
||||
$this->assertSame(get_string('emaildigestsubject', 'message_email'), $email->subject);
|
||||
$sitename = format_string($SITE->fullname);
|
||||
$this->assertSame(get_string('messagedigestemailsubject', 'message_email', $sitename), $email->subject);
|
||||
$this->assertSame($user2->email, $email->to);
|
||||
$this->assertNotEmpty($email->header);
|
||||
$emailbody = quoted_printable_decode($email->body);
|
||||
|
Loading…
x
Reference in New Issue
Block a user