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(),
|
||||
];
|
||||
|
||||
if ($this->defaultBoardService->checkFirstRun($this->userId, $AppName)) {
|
||||
if ($this->defaultBoardService->checkFirstRun($this->userId, $this->appName)) {
|
||||
$this->defaultBoardService->createDefaultBoard('Personal', $this->userId, '000000');
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?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>
|
||||
*
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
namespace OCA\Deck\Service;
|
||||
|
||||
use OCA\Deck\Db\BoardMapper;
|
||||
use OCA\Deck\Service\BoardService;
|
||||
use OCA\Deck\Service\StackService;
|
||||
use OCA\Deck\Service\CardService;
|
||||
@@ -30,12 +31,14 @@ use OCP\IConfig;
|
||||
|
||||
class DefaultBoardService {
|
||||
|
||||
private $boardMapper;
|
||||
private $boardService;
|
||||
private $stackService;
|
||||
private $cardService;
|
||||
private $config;
|
||||
|
||||
public function __construct(
|
||||
BoardMapper $boardMapper,
|
||||
BoardService $boardService,
|
||||
StackService $stackService,
|
||||
CardService $cardService,
|
||||
@@ -46,12 +49,14 @@ class DefaultBoardService {
|
||||
$this->stackService = $stackService;
|
||||
$this->cardService = $cardService;
|
||||
$this->config = $config;
|
||||
$this->boardMapper = $boardMapper;
|
||||
}
|
||||
|
||||
public function checkFirstRun($userId, $appName) {
|
||||
$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');
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user