diff --git a/.github/workflows/psalm.yml b/.github/workflows/psalm.yml index e9258903b..0b89569c9 100644 --- a/.github/workflows/psalm.yml +++ b/.github/workflows/psalm.yml @@ -41,4 +41,4 @@ jobs: run: composer i - name: Run coding standards check - run: composer run psalm + run: composer run psalm -- --threads=1 --monochrome --no-progress --output-format=github diff --git a/lib/Listeners/Files/ShareCreatedSendMail.php b/lib/Listeners/Files/ShareCreatedSendMail.php index c205df367..20827c493 100644 --- a/lib/Listeners/Files/ShareCreatedSendMail.php +++ b/lib/Listeners/Files/ShareCreatedSendMail.php @@ -32,6 +32,7 @@ use OCA\Circles\Tools\Traits\TStringTools; use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventListener; +use OCP\IUserManager; /** @template-implements IEventListener */ class ShareCreatedSendMail implements IEventListener { @@ -56,6 +57,8 @@ class ShareCreatedSendMail implements IEventListener { /** @var ContactService */ private $contactService; + /** @var IUserManager */ + private $userManager; public function __construct( ShareWrapperService $shareWrapperService, @@ -64,6 +67,7 @@ public function __construct( SendMailService $sendMailService, ContactService $contactService, ConfigService $configService, + IUserManager $userManager, ) { $this->shareWrapperService = $shareWrapperService; $this->shareTokenService = $shareTokenService; @@ -71,6 +75,7 @@ public function __construct( $this->sendMailService = $sendMailService; $this->contactService = $contactService; $this->configService = $configService; + $this->userManager = $userManager; $this->setup('app', Application::APP_ID); } @@ -127,6 +132,8 @@ public function handle(Event $event): void { if (!is_null($share)) { if ($share->hasInitiator()) { $author = $share->getInitiator()->getDisplayName(); + } elseif ($user = $this->userManager->get($share->getSharedBy())) { + $author = $user->getDisplayName(); } else { $author = 'someone'; } diff --git a/lib/Service/SyncService.php b/lib/Service/SyncService.php index 5de118a4f..e10ef3287 100644 --- a/lib/Service/SyncService.php +++ b/lib/Service/SyncService.php @@ -79,7 +79,7 @@ class SyncService { /** @var FederatedUserService */ private $federatedUserService; - /** @var federatedEventService */ + /** @var FederatedEventService */ private $federatedEventService; /** @var CircleService */ @@ -103,7 +103,7 @@ class SyncService { * @param CircleRequest $circleRequest * @param MemberRequest $memberRequest * @param FederatedUserService $federatedUserService - * @param federatedEventService $federatedEventService + * @param FederatedEventService $federatedEventService * @param CircleService $circleService * @param MembershipService $membershipService * @param OutputService $outputService @@ -115,7 +115,7 @@ public function __construct( CircleRequest $circleRequest, MemberRequest $memberRequest, FederatedUserService $federatedUserService, - federatedEventService $federatedEventService, + FederatedEventService $federatedEventService, CircleService $circleService, MembershipService $membershipService, OutputService $outputService, diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 5c461d186..07f08e6ed 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -6,13 +6,19 @@ * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ -define('PHPUNIT_RUN', 1); + +use OCP\App\IAppManager; +use OCP\Server; + +if (!defined('PHPUNIT_RUN')) { + define('PHPUNIT_RUN', 1); +} require_once __DIR__ . '/../../../lib/base.php'; require_once __DIR__ . '/../vendor/autoload.php'; require_once __DIR__ . '/../../../tests/autoload.php'; -\OC_App::loadApp('circles'); +Server::get(IAppManager::class)->loadApp('circles'); OC_Hook::clear(); diff --git a/tests/psalm-baseline.xml b/tests/psalm-baseline.xml index 24c0b3ca5..6def66372 100644 --- a/tests/psalm-baseline.xml +++ b/tests/psalm-baseline.xml @@ -240,12 +240,6 @@ - - - - - -