Skip to content
Snippets Groups Projects
Commit daf2bba0 authored by Moritz Strohm's avatar Moritz Strohm Committed by Jan-Hendrik Willms
Browse files

CalendarDateAssignment::cbSendDateDeletedMail: name the user that deleted the...

CalendarDateAssignment::cbSendDateDeletedMail: name the user that deleted the date instead of the editor, fixes #3884

Closes #3884

Merge request studip/studip!2735
parent 8b18b2d1
No related branches found
No related tags found
No related merge requests found
......@@ -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
);
......
......@@ -23,6 +23,6 @@
<? endforeach ?>
<? endif ?>
<? if ($receiver_date_assignment) : ?>
<? if (!empty($receiver_date_assignment)) : ?>
**Ihre Teilnahme:** <?= $receiver_date_assignment->getParticipationAsString() ?>
<? endif ?>
<?= $date->editor->getFullName() ?> hat einen Termin im Kalender gelöscht.
<?= $actor->getFullName() ?> hat einen Termin im Kalender gelöscht.
<?= $this->render_partial(__DIR__ . '/_date_information', [
'date' => $date,
......
......@@ -22,3 +22,7 @@
- <?= $participant_string ?>
<? endforeach ?>
<? endif ?>
<? if (!empty($receiver_date_assignment)) : ?>
**Your participation:** <?= $receiver_date_assignment->getParticipationAsString() ?>
<? endif ?>
<?= $date->editor->getFullName() ?> has deleted a date in the calendar.
<?= $actor->getFullName() ?> has deleted a date in the calendar.
<?= $this->render_partial(__DIR__ . '/_date_information', [
'date' => $date,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment