Skip to content

Commit

Permalink
Fix already shared event
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen committed Aug 4, 2023
1 parent c888ea9 commit 5214873
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
3 changes: 2 additions & 1 deletion lib/Chat/SystemMessage/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
15 changes: 11 additions & 4 deletions lib/Events/AlreadySharedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

0 comments on commit 5214873

Please sign in to comment.