Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
8 changes: 4 additions & 4 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ protected function registerCollaborationResourceProvider(IServerContainer $serve
/** @var IProviderManager $resourceManager */
$resourceManager = $server->get(IProviderManager::class);
$resourceManager->registerResourceProvider(ConversationProvider::class);
$server->getEventDispatcher()->addListener(LoadAdditionalScriptsEvent::class, static function () {
$server->get(IEventDispatcher::class)->addListener(LoadAdditionalScriptsEvent::class, static function () {
Util::addScript(self::APP_ID, 'talk-collections');
});
}
Expand Down
25 changes: 8 additions & 17 deletions lib/Chat/SystemMessage/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@
use OCP\IUser;
use OCP\IUserSession;
use OCP\Server;
use OCP\Share\Events\BeforeShareCreatedEvent;
use OCP\Share\Events\ShareCreatedEvent;
use OCP\Share\IShare;
use Symfony\Component\EventDispatcher\GenericEvent;

/**
* @template-implements IEventListener<Event>
Expand Down Expand Up @@ -86,8 +87,8 @@ public static function register(IEventDispatcher $dispatcher): void {
$dispatcher->addListener(Room::EVENT_AFTER_USERS_ADD, self::class . '::addSystemMessageUserAdded');
$dispatcher->addListener(Room::EVENT_AFTER_USER_REMOVE, self::class . '::sendSystemMessageUserRemoved');
$dispatcher->addListener(Room::EVENT_AFTER_PARTICIPANT_TYPE_SET, self::class . '::sendSystemMessageAboutPromoteOrDemoteModerator');
$dispatcher->addListener('OCP\Share::preShare', self::class . '::setShareExpiration');
$dispatcher->addListener('OCP\Share::postShare', self::class . '::fixMimeTypeOfVoiceMessage');
$dispatcher->addListener(BeforeShareCreatedEvent::class, self::class . '::setShareExpiration');
$dispatcher->addListener(ShareCreatedEvent::class, self::class . '::fixMimeTypeOfVoiceMessage');
$dispatcher->addListener(RoomShareProvider::EVENT_SHARE_FILE_AGAIN, self::class . '::fixMimeTypeOfVoiceMessage');
$dispatcher->addListener(Room::EVENT_AFTER_SET_MESSAGE_EXPIRATION, self::class . '::afterSetMessageExpiration');
$dispatcher->addListener(Room::EVENT_AFTER_SET_CALL_RECORDING, self::class . '::setCallRecording');
Expand Down Expand Up @@ -330,13 +331,8 @@ public static function sendSystemMessageAboutPromoteOrDemoteModerator(ModifyPart
}
}

/**
* @param GenericEvent|Event $event
* @return void
*/
public static function setShareExpiration($event): void {
/** @var IShare $share */
$share = $event->getSubject();
public static function setShareExpiration(BeforeShareCreatedEvent $event): void {
$share = $event->getShare();

if ($share->getShareType() !== IShare::TYPE_ROOM) {
return;
Expand All @@ -357,13 +353,8 @@ public static function setShareExpiration($event): void {
$share->setExpirationDate($dateTime);
}

/**
* @param GenericEvent|Event $event
* @return void
*/
public static function fixMimeTypeOfVoiceMessage($event): void {
/** @var IShare $share */
$share = $event->getSubject();
public static function fixMimeTypeOfVoiceMessage(ShareCreatedEvent $event): void {
$share = $event->getShare();

if ($share->getShareType() !== IShare::TYPE_ROOM) {
return;
Expand Down
11 changes: 5 additions & 6 deletions lib/Share/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@
use OCA\Talk\Config;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Server;
use OCP\Share\Events\BeforeShareCreatedEvent;
use OCP\Share\Events\VerifyMountPointEvent;
use OCP\Share\IShare;
use Symfony\Component\EventDispatcher\GenericEvent;

class Listener {
public static function register(IEventDispatcher $dispatcher): void {
/**
* @psalm-suppress UndefinedClass
*/
$dispatcher->addListener('OCP\Share::preShare', [self::class, 'listenPreShare'], 1000);
$dispatcher->addListener(BeforeShareCreatedEvent::class, [self::class, 'listenPreShare'], 1000);
$dispatcher->addListener(VerifyMountPointEvent::class, [self::class, 'listenVerifyMountPointEvent'], 1000);
}

public static function listenPreShare(GenericEvent $event): void {
public static function listenPreShare(BeforeShareCreatedEvent $event): void {
$listener = Server::get(self::class);
$listener->overwriteShareTarget($event);
}
Expand All @@ -55,9 +55,8 @@ public function __construct(
) {
}

public function overwriteShareTarget(GenericEvent $event): void {
/** @var IShare $share */
$share = $event->getSubject();
public function overwriteShareTarget(BeforeShareCreatedEvent $event): void {
$share = $event->getShare();

if ($share->getShareType() !== IShare::TYPE_ROOM
&& $share->getShareType() !== RoomShareProvider::SHARE_TYPE_USERROOM) {
Expand Down
2 changes: 0 additions & 2 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
<referencedClass name="OCA\Circles\Model\Member" />
<referencedClass name="OCA\DAV\CardDAV\PhotoCache" />
<referencedClass name="OCA\FederatedFileSharing\AddressHandler" />
<referencedClass name="Symfony\Component\EventDispatcher\EventDispatcherInterface" />
</errorLevel>
</UndefinedDocblockClass>
<UndefinedInterfaceMethod>
Expand All @@ -87,6 +86,5 @@
<file name="tests/stubs/GuzzleHttp_Exception_ClientException.php" />
<file name="tests/stubs/GuzzleHttp_Exception_ConnectException.php" />
<file name="tests/stubs/GuzzleHttp_Exception_ServerException.php" />
<file name="tests/stubs/Symfony_Component_EventDispatcher_GenericEvent.php" />
</stubs>
</psalm>

This file was deleted.