From daf2bba059fd373c7a20f982faf65c4572a8c326 Mon Sep 17 00:00:00 2001 From: Moritz Strohm Date: Mon, 25 Mar 2024 08:49:01 +0000 Subject: CalendarDateAssignment::cbSendDateDeletedMail: name the user that deleted the date instead of the editor, fixes #3884 Closes #3884 Merge request studip/studip!2735 --- lib/models/calendar/CalendarDateAssignment.class.php | 7 +++++-- locale/de/LC_MAILS/_date_information.php | 2 +- locale/de/LC_MAILS/date_deleted.php | 2 +- locale/en/LC_MAILS/_date_information.php | 4 ++++ locale/en/LC_MAILS/date_deleted.php | 2 +- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/models/calendar/CalendarDateAssignment.class.php b/lib/models/calendar/CalendarDateAssignment.class.php index 4e084c2..18cd610 100644 --- a/lib/models/calendar/CalendarDateAssignment.class.php +++ b/lib/models/calendar/CalendarDateAssignment.class.php @@ -102,7 +102,9 @@ class CalendarDateAssignment extends SimpleORMap implements Event if ($this->suppress_mails) { return; } - if ($this->range_id === $this->calendar_date->editor_id) { + $actor = User::findCurrent() ?? $this->calendar_date->editor; + if ($this->range_id === $actor->id) { + //The user who deleted the date shall not get notified about this. return; } if (!$this->calendar_date || !$this->user) { @@ -116,12 +118,13 @@ class CalendarDateAssignment extends SimpleORMap implements Event $lang_path = getUserLanguagePath($this->range_id); $template = $template_factory->open($lang_path . '/LC_MAILS/date_deleted.php'); $template->set_attribute('date', $this->calendar_date); + $template->set_attribute('actor', $actor); $template->set_attribute('receiver', $this->user); $mail_text = $template->render(); Message::send( '____%system%____', [$this->user->username], - sprintf(_('%s hat einen Termin im Kalender gelöscht'), $this->calendar_date->editor->getFullName()), + sprintf(_('%s hat einen Termin im Kalender gelöscht'), $actor->getFullName()), $mail_text ); diff --git a/locale/de/LC_MAILS/_date_information.php b/locale/de/LC_MAILS/_date_information.php index 5eab14d..ac8e981 100644 --- a/locale/de/LC_MAILS/_date_information.php +++ b/locale/de/LC_MAILS/_date_information.php @@ -23,6 +23,6 @@ - + **Ihre Teilnahme:** getParticipationAsString() ?> diff --git a/locale/de/LC_MAILS/date_deleted.php b/locale/de/LC_MAILS/date_deleted.php index 0ff6ef8..0f319d3 100644 --- a/locale/de/LC_MAILS/date_deleted.php +++ b/locale/de/LC_MAILS/date_deleted.php @@ -1,4 +1,4 @@ -editor->getFullName() ?> hat einen Termin im Kalender gelöscht. +getFullName() ?> hat einen Termin im Kalender gelöscht. render_partial(__DIR__ . '/_date_information', [ 'date' => $date, diff --git a/locale/en/LC_MAILS/_date_information.php b/locale/en/LC_MAILS/_date_information.php index a0cb470..0619261 100644 --- a/locale/en/LC_MAILS/_date_information.php +++ b/locale/en/LC_MAILS/_date_information.php @@ -22,3 +22,7 @@ - + + +**Your participation:** getParticipationAsString() ?> + diff --git a/locale/en/LC_MAILS/date_deleted.php b/locale/en/LC_MAILS/date_deleted.php index b4bafd6..91ef248 100644 --- a/locale/en/LC_MAILS/date_deleted.php +++ b/locale/en/LC_MAILS/date_deleted.php @@ -1,4 +1,4 @@ -editor->getFullName() ?> has deleted a date in the calendar. +getFullName() ?> has deleted a date in the calendar. render_partial(__DIR__ . '/_date_information', [ 'date' => $date, -- cgit v1.0