Some psalm fixes for the DashboardController
* Use the AppFramework IInitialState * Set return type Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
parent
2f26ff40e9
commit
a6cd238517
|
@ -36,18 +36,18 @@ use OCP\AppFramework\Http\JSONResponse;
|
||||||
use OCP\AppFramework\Http\NotFoundResponse;
|
use OCP\AppFramework\Http\NotFoundResponse;
|
||||||
use OCP\AppFramework\Http\TemplateResponse;
|
use OCP\AppFramework\Http\TemplateResponse;
|
||||||
use OCP\App\IAppManager;
|
use OCP\App\IAppManager;
|
||||||
|
use OCP\AppFramework\Services\IInitialState;
|
||||||
use OCP\Dashboard\IManager;
|
use OCP\Dashboard\IManager;
|
||||||
use OCP\Dashboard\IWidget;
|
use OCP\Dashboard\IWidget;
|
||||||
use OCP\Dashboard\RegisterWidgetEvent;
|
use OCP\Dashboard\RegisterWidgetEvent;
|
||||||
use OCP\EventDispatcher\IEventDispatcher;
|
use OCP\EventDispatcher\IEventDispatcher;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use OCP\IInitialStateService;
|
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
|
|
||||||
class DashboardController extends Controller {
|
class DashboardController extends Controller {
|
||||||
|
|
||||||
/** @var IInitialStateService */
|
/** @var IInitialState */
|
||||||
private $inititalStateService;
|
private $inititalState;
|
||||||
/** @var IEventDispatcher */
|
/** @var IEventDispatcher */
|
||||||
private $eventDispatcher;
|
private $eventDispatcher;
|
||||||
/** @var IAppManager */
|
/** @var IAppManager */
|
||||||
|
@ -66,7 +66,7 @@ class DashboardController extends Controller {
|
||||||
public function __construct(
|
public function __construct(
|
||||||
string $appName,
|
string $appName,
|
||||||
IRequest $request,
|
IRequest $request,
|
||||||
IInitialStateService $initialStateService,
|
IInitialState $initialState,
|
||||||
IEventDispatcher $eventDispatcher,
|
IEventDispatcher $eventDispatcher,
|
||||||
IAppManager $appManager,
|
IAppManager $appManager,
|
||||||
IManager $dashboardManager,
|
IManager $dashboardManager,
|
||||||
|
@ -76,7 +76,7 @@ class DashboardController extends Controller {
|
||||||
) {
|
) {
|
||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
|
|
||||||
$this->inititalStateService = $initialStateService;
|
$this->inititalState = $initialState;
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
$this->appManager = $appManager;
|
$this->appManager = $appManager;
|
||||||
$this->dashboardManager = $dashboardManager;
|
$this->dashboardManager = $dashboardManager;
|
||||||
|
@ -119,14 +119,14 @@ class DashboardController extends Controller {
|
||||||
$themingDefaultBackground = $this->appManager->isEnabledForUser('theming')
|
$themingDefaultBackground = $this->appManager->isEnabledForUser('theming')
|
||||||
? $this->config->getAppValue('theming', 'backgroundMime', '')
|
? $this->config->getAppValue('theming', 'backgroundMime', '')
|
||||||
: '';
|
: '';
|
||||||
$this->inititalStateService->provideInitialState('dashboard', 'themingDefaultBackground', $themingDefaultBackground);
|
$this->inititalState->provideInitialState('themingDefaultBackground', $themingDefaultBackground);
|
||||||
$this->inititalStateService->provideInitialState('dashboard', 'panels', $widgets);
|
$this->inititalState->provideInitialState('panels', $widgets);
|
||||||
$this->inititalStateService->provideInitialState('dashboard', 'statuses', $statuses);
|
$this->inititalState->provideInitialState('statuses', $statuses);
|
||||||
$this->inititalStateService->provideInitialState('dashboard', 'layout', $userLayout);
|
$this->inititalState->provideInitialState('layout', $userLayout);
|
||||||
$this->inititalStateService->provideInitialState('dashboard', 'firstRun', $this->config->getUserValue($this->userId, 'dashboard', 'firstRun', '1') === '1');
|
$this->inititalState->provideInitialState('firstRun', $this->config->getUserValue($this->userId, 'dashboard', 'firstRun', '1') === '1');
|
||||||
$this->inititalStateService->provideInitialState('dashboard', 'shippedBackgrounds', BackgroundService::SHIPPED_BACKGROUNDS);
|
$this->inititalState->provideInitialState('shippedBackgrounds', BackgroundService::SHIPPED_BACKGROUNDS);
|
||||||
$this->inititalStateService->provideInitialState('dashboard', 'background', $this->config->getUserValue($this->userId, 'dashboard', 'background', 'default'));
|
$this->inititalState->provideInitialState('background', $this->config->getUserValue($this->userId, 'dashboard', 'background', 'default'));
|
||||||
$this->inititalStateService->provideInitialState('dashboard', 'version', $this->config->getUserValue($this->userId, 'dashboard', 'backgroundVersion', 0));
|
$this->inititalState->provideInitialState('version', $this->config->getUserValue($this->userId, 'dashboard', 'backgroundVersion', 0));
|
||||||
$this->config->setUserValue($this->userId, 'dashboard', 'firstRun', '0');
|
$this->config->setUserValue($this->userId, 'dashboard', 'firstRun', '0');
|
||||||
|
|
||||||
$response = new TemplateResponse('dashboard', 'index');
|
$response = new TemplateResponse('dashboard', 'index');
|
||||||
|
@ -199,7 +199,7 @@ class DashboardController extends Controller {
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
* @NoCSRFRequired
|
* @NoCSRFRequired
|
||||||
*/
|
*/
|
||||||
public function getBackground() {
|
public function getBackground(): Http\Response {
|
||||||
$file = $this->backgroundService->getBackground();
|
$file = $this->backgroundService->getBackground();
|
||||||
if ($file !== null) {
|
if ($file !== null) {
|
||||||
$response = new FileDisplayResponse($file, Http::STATUS_OK, ['Content-Type' => $file->getMimeType()]);
|
$response = new FileDisplayResponse($file, Http::STATUS_OK, ['Content-Type' => $file->getMimeType()]);
|
||||||
|
|
Loading…
Reference in New Issue