Skip to content
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
36 changes: 4 additions & 32 deletions lib/Controller/FilesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
use OCP\Files\Config\IMountProviderCollection;
use OCP\Files\FileInfo;
use OCP\Files\IRootFolder;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\IL10N;
use OCP\ILogger;
use OCP\IRequest;
use OCP\AppFramework\OCSController;
Expand All @@ -34,7 +32,7 @@
use OCP\IUser;
use OCP\IUserManager;
use OCP\IUserSession;
use OCP\RichObjectStrings\IValidator;
use OCP\Server;
use Throwable;
use OCP\Files\DavUtil;

Expand All @@ -60,26 +58,11 @@ class FilesController extends OCSController {
/** @var IDBConnection */
protected $connection;

/**
* @var IValidator
*/
private $richObjectValidator;

/**
* @var ILogger
*/
private $logger;

/**
* @var IL10N
*/
private $l;

/**
* @var IConfig
*/
private $config;

/**
* @var IUserManager
*/
Expand All @@ -105,10 +88,7 @@ public function __construct(string $appName,
IManager $activityManager,
IAppManager $appManager,
IDBConnection $connection,
IValidator $richObjectValidator,
ILogger $logger,
IL10N $l,
IConfig $config,
IUserManager $userManager,
DavUtil $davUtils
) {
Expand All @@ -118,10 +98,7 @@ public function __construct(string $appName,
$this->mountCollection = $mountCollection;
$this->activityManager = $activityManager;
$this->connection = $connection;
$this->richObjectValidator = $richObjectValidator;
$this->logger = $logger;
$this->l = $l;
$this->config = $config;
$this->userManager = $userManager;
$this->appManager = $appManager;
$this->davUtils = $davUtils;
Expand Down Expand Up @@ -281,20 +258,15 @@ private function getLastModifier(string $ownerId, int $fileId, int $since = 0):
class_exists('\OCA\Activity\GroupHelperDisabled') &&
class_exists('\OCA\Activity\UserSettings')
) {
$activityData = new Data($this->activityManager, $this->connection);
$activityData = Server::get(Data::class);
} else {
return null;
}

// @phpstan-ignore-next-line - make phpstan not complain if activity app does not exist
$groupHelper = new GroupHelperDisabled(
$this->l,
$this->activityManager,
$this->richObjectValidator,
$this->logger
);
$groupHelper = Server::get(GroupHelperDisabled::class);
// @phpstan-ignore-next-line - make phpstan not complain if activity app does not exist
$userSettings = new UserSettings($this->activityManager, $this->config);
$userSettings = Server::get(UserSettings::class);
if (!method_exists($activityData, 'get') ||
!method_exists($activityData, 'getById')
) {
Expand Down
9 changes: 0 additions & 9 deletions tests/lib/Controller/FilesControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@
use OCP\Files\Config\ICachedMountFileInfo;
use OCP\Files\DavUtil;
use OCP\Files\Node;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\IL10N;
use OCP\ILogger;
use OCP\IRequest;
use OCP\IUserManager;
use OCP\RichObjectStrings\IValidator;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use function PHPUnit\Framework\assertSame;
Expand Down Expand Up @@ -1012,10 +1009,7 @@ private function createFilesController(
$this->createMock(IManager::class),
$appManagerMock,
$this->createMock(IDBConnection::class),
$this->createMock(IValidator::class),
$this->createMock(ILogger::class),
$this->createMock(IL10N::class),
$this->createMock(IConfig::class),
$this->createMock(IUserManager::class),
$this->createMock(DavUtil::class)
);
Expand Down Expand Up @@ -1078,10 +1072,7 @@ public function getFilesControllerMock(
$this->createMock(IManager::class),
$appManagerMock,
$this->createMock(IDBConnection::class),
$this->createMock(IValidator::class),
$this->createMock(ILogger::class),
$this->createMock(IL10N::class),
$this->createMock(IConfig::class),
$this->createMock(IUserManager::class),
$davUtilsMock
])
Expand Down