diff --git a/lib/Activity/Provider.php b/lib/Activity/Provider.php index 15f446af..6782a791 100644 --- a/lib/Activity/Provider.php +++ b/lib/Activity/Provider.php @@ -100,14 +100,16 @@ public function parse($language, IEvent $event, IEvent $previousEvent = null) { 'id' => $params[0], 'name' => $params[0], ]; + $parameters['file'] = [ + 'type' => 'highlight', + 'id' => $event->getObjectName(), + 'name' => $event->getObjectName(), + ]; if ($event->getMessage() === self::MESSAGE_FILE_DELETED) { $event->setParsedMessage($l->t('The file has been removed')); - - $parameters['file'] = $this->getFileDeleted($event); $event->setIcon($this->urlGenerator->imagePath('files_antivirus', 'shield-dark.svg')); } else { - $parameters['file'] = $this->getFileExisting($event); $event->setIcon($this->urlGenerator->imagePath('files_antivirus', 'shield-red.svg')); } } @@ -131,24 +133,4 @@ private function setSubjects(IEvent $event, string $subject, array $parameters): $event->setParsedSubject(str_replace($placeholders, $replacements, $subject)) ->setRichSubject($subject, $parameters); } - - private function getFileExisting(IEvent $event) { - $res = $this->getFileDeleted($event); - $res['link'] = $this->urlGenerator->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $event->getObjectId()]); - return $res; - } - - /** - * @return (int|string)[] - * - * @psalm-return array{type: 'file', id: int, name: string, path: string} - */ - private function getFileDeleted(IEvent $event): array { - return [ - 'type' => 'file', - 'id' => $event->getObjectId(), - 'name' => basename($event->getObjectName()), - 'path' => $event->getObjectName(), - ]; - } }