Completed checkFirstRun() in DefaultBoardService.php
Signed-off-by: Ryan Fletcher <ryan.fletcher@codepassion.ca>
This commit is contained in:
@@ -58,7 +58,7 @@ class PageController extends Controller {
|
|||||||
'maxUploadSize' => \OCP\Util::uploadLimit(),
|
'maxUploadSize' => \OCP\Util::uploadLimit(),
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($this->defaultBoardService->checkFirstRun($this->userId, $AppName)) {
|
if ($this->defaultBoardService->checkFirstRun($this->userId, $this->appName)) {
|
||||||
$this->defaultBoardService->createDefaultBoard('Personal', $this->userId, '000000');
|
$this->defaultBoardService->createDefaultBoard('Personal', $this->userId, '000000');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @copyright Copyright (c) 2016 Julius Härtl <jus@bitgrid.net>
|
* @copyright Copyright (c) 2018 Ryan Fletcher <ryan.fletcher@codepassion.ca>
|
||||||
*
|
*
|
||||||
* @author Ryan Fletcher <ryan.fletcher@codepassion.ca>
|
* @author Ryan Fletcher <ryan.fletcher@codepassion.ca>
|
||||||
*
|
*
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
namespace OCA\Deck\Service;
|
namespace OCA\Deck\Service;
|
||||||
|
|
||||||
|
use OCA\Deck\Db\BoardMapper;
|
||||||
use OCA\Deck\Service\BoardService;
|
use OCA\Deck\Service\BoardService;
|
||||||
use OCA\Deck\Service\StackService;
|
use OCA\Deck\Service\StackService;
|
||||||
use OCA\Deck\Service\CardService;
|
use OCA\Deck\Service\CardService;
|
||||||
@@ -30,12 +31,14 @@ use OCP\IConfig;
|
|||||||
|
|
||||||
class DefaultBoardService {
|
class DefaultBoardService {
|
||||||
|
|
||||||
|
private $boardMapper;
|
||||||
private $boardService;
|
private $boardService;
|
||||||
private $stackService;
|
private $stackService;
|
||||||
private $cardService;
|
private $cardService;
|
||||||
private $config;
|
private $config;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
BoardMapper $boardMapper,
|
||||||
BoardService $boardService,
|
BoardService $boardService,
|
||||||
StackService $stackService,
|
StackService $stackService,
|
||||||
CardService $cardService,
|
CardService $cardService,
|
||||||
@@ -46,12 +49,14 @@ class DefaultBoardService {
|
|||||||
$this->stackService = $stackService;
|
$this->stackService = $stackService;
|
||||||
$this->cardService = $cardService;
|
$this->cardService = $cardService;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
|
$this->boardMapper = $boardMapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkFirstRun($userId, $appName) {
|
public function checkFirstRun($userId, $appName) {
|
||||||
$firstRun = $this->config->getUserValue($userId,$appName,'firstRun','yes');
|
$firstRun = $this->config->getUserValue($userId,$appName,'firstRun','yes');
|
||||||
|
$userBoards = $this->boardMapper->findAllByUser($userId);
|
||||||
|
|
||||||
if ($firstRun == 'yes') {
|
if ($firstRun === 'yes' && count($userBoards) === 0) {
|
||||||
$this->config->setUserValue($userId,$appName,'firstRun','no');
|
$this->config->setUserValue($userId,$appName,'firstRun','no');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user