fix(appointments): calendar booking notifications
Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
This commit is contained in:
parent
7e8f1a0d7b
commit
a61f7a9155
|
@ -75,12 +75,6 @@ class Notifier implements INotifier {
|
||||||
'link' => $this->url->linkToRouteAbsolute('calendar.view.index')
|
'link' => $this->url->linkToRouteAbsolute('calendar.view.index')
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
$placeholders = $replacements = [];
|
|
||||||
foreach ($notification->getRichSubjectParameters() as $placeholder => $parameter) {
|
|
||||||
$placeholders[] = '{' . $placeholder . '}';
|
|
||||||
$replacements[] = $parameter[$placeholder];
|
|
||||||
}
|
|
||||||
$notification->setParsedSubject(str_replace($placeholders, $replacements, $notification->getRichSubject()));
|
|
||||||
|
|
||||||
$messageParameters = $notification->getMessageParameters();
|
$messageParameters = $notification->getMessageParameters();
|
||||||
$notification->setRichMessage($l->t('{display_name} ({email}) booked the appointment "{config_display_name}" on {date_time}.'), [
|
$notification->setRichMessage($l->t('{display_name} ({email}) booked the appointment "{config_display_name}" on {date_time}.'), [
|
||||||
|
@ -105,17 +99,11 @@ class Notifier implements INotifier {
|
||||||
'name' => $messageParameters['config_display_name'],
|
'name' => $messageParameters['config_display_name'],
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
foreach ($notification->getRichMessageParameters() as $placeholder => $parameter) {
|
|
||||||
$placeholders[] = '{' . $placeholder . '}';
|
|
||||||
$replacements[] = $parameter[$placeholder];
|
|
||||||
}
|
|
||||||
$notification->setParsedMessage(str_replace($placeholders, $replacements, $notification->getRichMessage()));
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new \InvalidArgumentException();
|
throw new \InvalidArgumentException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return $notification;
|
return $notification;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,20 +179,12 @@ class NotifierTest extends \PHPUnit\Framework\TestCase {
|
||||||
$notification->expects($this->once())
|
$notification->expects($this->once())
|
||||||
->method('setRichSubject')
|
->method('setRichSubject')
|
||||||
->with('New booking {booking}', $booking);
|
->with('New booking {booking}', $booking);
|
||||||
$notification->expects($this->once())
|
|
||||||
->method('getRichSubjectParameters');
|
|
||||||
$notification->expects(self::once())
|
|
||||||
->method('setParsedSubject');
|
|
||||||
$notification->expects(self::once())
|
$notification->expects(self::once())
|
||||||
->method('getMessageParameters')
|
->method('getMessageParameters')
|
||||||
->willReturn($messageParameters);
|
->willReturn($messageParameters);
|
||||||
$notification->expects($this->once())
|
$notification->expects($this->once())
|
||||||
->method('setRichMessage')
|
->method('setRichMessage')
|
||||||
->with('{display_name} ({email}) booked the appointment "{config_display_name}" on {date_time}.', $messageRichData);
|
->with('{display_name} ({email}) booked the appointment "{config_display_name}" on {date_time}.', $messageRichData);
|
||||||
$notification->expects($this->once())
|
|
||||||
->method('getRichMessageParameters');
|
|
||||||
$notification->expects(self::once())
|
|
||||||
->method('setParsedMessage');
|
|
||||||
|
|
||||||
$return = $this->notifier->prepare($notification, 'de');
|
$return = $this->notifier->prepare($notification, 'de');
|
||||||
$this->assertEquals($notification, $return);
|
$this->assertEquals($notification, $return);
|
||||||
|
|
Loading…
Reference in New Issue