From ed64f30bd0e03bb05b518160bfa0903470781fe0 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Wed, 9 Aug 2023 09:20:48 +0200 Subject: [PATCH] fixup! feat(caldav): linkify location in scheduling mails Signed-off-by: Christoph Wurst --- apps/dav/lib/CalDAV/Schedule/IMipService.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/apps/dav/lib/CalDAV/Schedule/IMipService.php b/apps/dav/lib/CalDAV/Schedule/IMipService.php index 577060563a48b..e6d1bbcd875b9 100644 --- a/apps/dav/lib/CalDAV/Schedule/IMipService.php +++ b/apps/dav/lib/CalDAV/Schedule/IMipService.php @@ -110,17 +110,20 @@ private function generateDiffString(VEvent $vevent, VEvent $oldVEvent, string $p * Like generateDiffString() but linkifies the property values if they are urls. */ private function generateLinkifiedDiffString(VEvent $vevent, VEvent $oldVEvent, string $property, string $default): ?string { - $strikethrough = "%s
%s"; if (!isset($vevent->$property)) { return $default; } - /** @var string|null $newstring */ - $newstring = $vevent->$property->getValue(); - if (isset($oldVEvent->$property) && $oldVEvent->$property->getValue() !== $newstring) { - $oldstring = $oldVEvent->$property->getValue(); - return sprintf($strikethrough, $this->linkify($oldstring) ?? $oldstring, $this->linkify($newstring) ?? $newstring); - } - return $this->linkify($newstring) ?? $newstring; + /** @var string|null $newString */ + $newString = $vevent->$property->getValue(); + $oldString = isset($oldVEvent->$property) ? $oldVEvent->$property->getValue() : null; + if ($oldString !== $newString) { + return sprintf( + "%s
%s", + $this->linkify($oldString) ?? $oldString ?? '', + $this->linkify($newString) ?? $newString ?? '' + ); + } + return $this->linkify($newString) ?? $newString; } /**