Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix already shared event #10107

Merged
merged 1 commit into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
}