This commit is contained in:
sualko 2019-04-16 15:22:32 +02:00
Родитель 342e264c96
Коммит 43242a0db3
6 изменённых файлов: 11 добавлений и 43 удалений

Просмотреть файл

@ -1,7 +1,6 @@
<?php
$finder = PhpCsFixer\Finder::create()
->in('lib/')
->in('settings/')
->in('tests/')
;
return PhpCsFixer\Config::create()

Просмотреть файл

@ -3,8 +3,6 @@
use OCA\OJSXC\AppInfo\Application;
use OCA\OJSXC\Hooks;
\OCP\App::registerPersonal('ojsxc', 'settings/personal');
$isDevEnv = \OC::$server->getConfig()->getSystemValue('jsxc.environment') === 'dev';
$jsxc_root = ($isDevEnv)? 'jsxc/dev/' : 'jsxc/';
$jsProdSuffix = (!$isDevEnv)? '.min' : '';

Просмотреть файл

@ -29,7 +29,7 @@
<screenshot>https://www.jsxc.org/assets/screenshot-nextcloud-latest.png</screenshot>
<dependencies>
<php min-version="5.4" max-version="7"/>
<php min-version="7" max-version="7"/>
<database>sqlite</database>
<database>mysql</database>
<database>pgsql</database>
@ -37,7 +37,7 @@
<lib>xmlreader</lib>
<lib>xmlwriter</lib>
<lib>dom</lib>
<nextcloud min-version="12" max-version="16"/>
<nextcloud min-version="14" max-version="16"/>
</dependencies>
<repair-steps>

Просмотреть файл

@ -86,7 +86,7 @@ class ManagedServerController extends Controller
$apiUrl = $this->urlGenerator->linkToRouteAbsolute('ojsxc.externalApi.index');
$apiSecret = $this->config->getAppValue('ojsxc', 'apiSecret');
$userId = $this->userSession->getUser()->getUID();
$appVersion = '3.4.0'; //$this->appManager->getAppVersion('ojsxc'); from NC 14
$appVersion = $this->appManager->getAppVersion('ojsxc');
$data = [
'apiUrl' => $apiUrl,

Просмотреть файл

@ -1,36 +0,0 @@
<?php
/**
* This is required until NC 13.
*/
OCP\User::checkLoggedIn();
OCP\Util::addScript('ojsxc', 'settings/personal');
$config = \OC::$server->getConfig();
$tmpl = new \OCP\Template('ojsxc', 'settings/personal');
$currentUID = \OC::$server->getUserSession()->getUser()->getUID();
$options = $config->getUserValue($currentUID, 'ojsxc', 'options');
if ($options !== null) {
$options = (array) json_decode($options, true);
if (is_array($options)) {
$loginFormEnable = null;
if (isset($options['loginForm']) && is_array($options['loginForm']) && isset($options['loginForm']['enable'])) {
$loginFormEnable = $options['loginForm']['enable'];
}
if ($loginFormEnable === true || $loginFormEnable === 'true') {
$tmpl->assign('loginForm', 'enable');
} elseif ($loginFormEnable === false || $loginFormEnable === 'false') {
$tmpl->assign('loginForm', 'disable');
} else {
$tmpl->assign('loginForm', 'default');
}
}
}
return $tmpl->fetchPage();

Просмотреть файл

@ -27,6 +27,7 @@ class ManagedServerControllerTest extends TestCase
private $random;
private $registrationUrl;
private $appVersion;
private $apiUrl;
private $apiSecret;
private $userId;
@ -47,6 +48,7 @@ class ManagedServerControllerTest extends TestCase
$this->appManager = $this->createMock(IAppManager::class);
$this->registrationUrl = '';
$this->appVersion = '9.9.9';
$this->apiUrl = 'https://localhost/api';
$this->apiSecret = 'dummySecret';
$this->userId = 'dummyUser';
@ -69,6 +71,11 @@ class ManagedServerControllerTest extends TestCase
->expects($this->once())
->method('getUser')
->willReturn($this->createUserMock($this->userId));
$this->appManager
->expects($this->once())
->method('getAppVersion')
->with('ojsxc')
->willReturn($this->appVersion);
$this->managedServerController = new ManagedServerController(
'ojsxc',
@ -190,7 +197,7 @@ class ManagedServerControllerTest extends TestCase
'apiSecret' => $this->apiSecret,
'apiVersion' => 1,
'userId' => $this->userId,
'appVersion' => '3.4.0',
'appVersion' => $this->appVersion,
'promotionCode' => $expectedPromotionCode
])
->willReturn([