Use DI for tq everywhere
Signed-off-by: Varun Patil <varunpatil@ucla.edu>pull/563/head
parent
f284085a1a
commit
bd6aaeee3a
|
@ -55,7 +55,8 @@ abstract class GenericApiController extends Controller
|
|||
IDBConnection $connection,
|
||||
IRootFolder $rootFolder,
|
||||
IAppManager $appManager,
|
||||
LoggerInterface $logger
|
||||
LoggerInterface $logger,
|
||||
TimelineQuery $timelineQuery
|
||||
) {
|
||||
parent::__construct(Application::APPNAME, $request);
|
||||
|
||||
|
@ -65,6 +66,6 @@ abstract class GenericApiController extends Controller
|
|||
$this->rootFolder = $rootFolder;
|
||||
$this->appManager = $appManager;
|
||||
$this->logger = $logger;
|
||||
$this->timelineQuery = new TimelineQuery($connection);
|
||||
$this->timelineQuery = $timelineQuery;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ use OCP\AppFramework\Services\IInitialState;
|
|||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
use OCP\Files\IRootFolder;
|
||||
use OCP\IConfig;
|
||||
use OCP\IDBConnection;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\IUserSession;
|
||||
use OCP\Util;
|
||||
|
@ -24,7 +23,6 @@ class PublicAlbumController extends Controller
|
|||
protected IInitialState $initialState;
|
||||
protected IAppManager $appManager;
|
||||
protected IConfig $config;
|
||||
protected IDBConnection $connection;
|
||||
protected IUserSession $userSession;
|
||||
protected IRootFolder $rootFolder;
|
||||
protected IURLGenerator $urlGenerator;
|
||||
|
@ -36,21 +34,20 @@ class PublicAlbumController extends Controller
|
|||
IInitialState $initialState,
|
||||
IAppManager $appManager,
|
||||
IConfig $config,
|
||||
IDBConnection $connection,
|
||||
IUserSession $userSession,
|
||||
IRootFolder $rootFolder,
|
||||
IURLGenerator $urlGenerator
|
||||
IURLGenerator $urlGenerator,
|
||||
TimelineQuery $timelineQuery
|
||||
) {
|
||||
$this->appName = $appName;
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
$this->initialState = $initialState;
|
||||
$this->appManager = $appManager;
|
||||
$this->config = $config;
|
||||
$this->connection = $connection;
|
||||
$this->userSession = $userSession;
|
||||
$this->rootFolder = $rootFolder;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
$this->timelineQuery = new TimelineQuery($this->connection);
|
||||
$this->timelineQuery = $timelineQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,7 +13,6 @@ use OCP\EventDispatcher\IEventDispatcher;
|
|||
use OCP\Files\IRootFolder;
|
||||
use OCP\Files\NotFoundException;
|
||||
use OCP\IConfig;
|
||||
use OCP\IDBConnection;
|
||||
use OCP\IRequest;
|
||||
use OCP\ISession;
|
||||
use OCP\IURLGenerator;
|
||||
|
@ -33,8 +32,8 @@ class PublicController extends AuthPublicShareController
|
|||
protected IShareManager $shareManager;
|
||||
protected IUserManager $userManager;
|
||||
protected IAppManager $appManager;
|
||||
protected IDBConnection $db;
|
||||
protected IConfig $config;
|
||||
protected TimelineQuery $timelineQuery;
|
||||
|
||||
protected IShare $share;
|
||||
|
||||
|
@ -50,8 +49,8 @@ class PublicController extends AuthPublicShareController
|
|||
IShareManager $shareManager,
|
||||
IUserManager $userManager,
|
||||
IAppManager $appManager,
|
||||
IDBConnection $db,
|
||||
IConfig $config
|
||||
IConfig $config,
|
||||
TimelineQuery $timelineQuery
|
||||
) {
|
||||
parent::__construct($AppName, $request, $session, $urlGenerator);
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
|
@ -61,8 +60,8 @@ class PublicController extends AuthPublicShareController
|
|||
$this->shareManager = $shareManager;
|
||||
$this->userManager = $userManager;
|
||||
$this->appManager = $appManager;
|
||||
$this->db = $db;
|
||||
$this->config = $config;
|
||||
$this->timelineQuery = $timelineQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -257,8 +256,7 @@ class PublicController extends AuthPublicShareController
|
|||
/** Get initial state of single item */
|
||||
private function getSingleItemInitialState(\OCP\Files\File $file): string
|
||||
{
|
||||
$timelineQuery = new TimelineQuery($this->db);
|
||||
$photo = $timelineQuery->getSingleItem($file->getId());
|
||||
$photo = $this->timelineQuery->getSingleItem($file->getId());
|
||||
|
||||
return json_encode($photo);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue