From 52148735fd951c70bdbcbee0479240c39a693fa2 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 4 Aug 2023 16:04:07 +0200 Subject: [PATCH] Fix already shared event Signed-off-by: Joas Schilling --- lib/Chat/SystemMessage/Listener.php | 3 ++- lib/Events/AlreadySharedEvent.php | 15 +++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/Chat/SystemMessage/Listener.php b/lib/Chat/SystemMessage/Listener.php index d6a4c0cde2b..0327aa9d0cd 100644 --- a/lib/Chat/SystemMessage/Listener.php +++ b/lib/Chat/SystemMessage/Listener.php @@ -26,6 +26,7 @@ use DateInterval; use OCA\Talk\Chat\ChatManager; use OCA\Talk\Events\AddParticipantsEvent; +use OCA\Talk\Events\AlreadySharedEvent; use OCA\Talk\Events\AttendeesAddedEvent; use OCA\Talk\Events\AttendeesRemovedEvent; use OCA\Talk\Events\ModifyEveryoneEvent; @@ -353,7 +354,7 @@ public static function setShareExpiration(BeforeShareCreatedEvent $event): void $share->setExpirationDate($dateTime); } - public static function fixMimeTypeOfVoiceMessage(ShareCreatedEvent $event): void { + public static function fixMimeTypeOfVoiceMessage(ShareCreatedEvent|AlreadySharedEvent $event): void { $share = $event->getShare(); if ($share->getShareType() !== IShare::TYPE_ROOM) { diff --git a/lib/Events/AlreadySharedEvent.php b/lib/Events/AlreadySharedEvent.php index 20d47886cd3..b8446fd3224 100644 --- a/lib/Events/AlreadySharedEvent.php +++ b/lib/Events/AlreadySharedEvent.php @@ -27,19 +27,26 @@ namespace OCA\Talk\Events; use OCP\EventDispatcher\Event; +use OCP\Share\IShare; class AlreadySharedEvent extends Event { public function __construct( - private $subject = null, + private IShare $share, ) { + parent::__construct(); } /** * Getter for subject property. * - * @return mixed + * @return IShare + * @deprecated */ - public function getSubject() { - return $this->subject; + public function getSubject(): IShare { + return $this->share; + } + + public function getShare(): IShare { + return $this->share; } }