Fix syntax

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2020-07-09 17:25:30 +02:00
parent 73823f4507
commit 8cd975f325
No known key found for this signature in database
GPG Key ID: 60C25B8C072916CF
8 changed files with 531 additions and 1540 deletions

View File

@ -21,14 +21,14 @@
* *
*/ */
namespace OCA\Contacts\AppInfo; namespace OCA\Contacts\AppInfo;
use OCP\AppFramework\App; use OCP\AppFramework\App;
use OCP\IURLGenerator; use OCP\IURLGenerator;
use OCP\IL10N; use OCP\IL10N;
use OCP\INavigationManager; use OCP\INavigationManager;
class Application extends App { class Application extends App {
public const APP_ID = 'contacts';
const APP_ID = 'contacts';
public function __construct() { public function __construct() {
parent::__construct(self::APP_ID); parent::__construct(self::APP_ID);
@ -65,6 +65,5 @@ class Application extends App {
// navigation or on the settings page of your app // navigation or on the settings page of your app
'name' => $l10n->t('Contacts'), 'name' => $l10n->t('Contacts'),
]); ]);
} }
} }

View File

@ -67,13 +67,13 @@ class DetailsProvider implements IProvider {
/** /**
* Return a list of the user's addressbooks unique uris * Return a list of the user's addressbooks unique uris
* *
* @return array * @return array
* @since 16.0.0 * @since 16.0.0
*/ */
protected function getAddressBooksUris(): Array { protected function getAddressBooksUris(): array {
$result = array(); $result = [];
foreach($this->manager->getUserAddressbooks() as $addressBook) { foreach ($this->manager->getUserAddressbooks() as $addressBook) {
$result[$addressBook->getKey()] = $addressBook->getUri(); $result[$addressBook->getKey()] = $addressBook->getUri();
} }
@ -114,7 +114,6 @@ class DetailsProvider implements IProvider {
// We need $this->manager->getAddressbooksUris() to add this function // We need $this->manager->getAddressbooksUris() to add this function
$ncVersion = $this->config->getSystemValue('version', '0.0.0'); $ncVersion = $this->config->getSystemValue('version', '0.0.0');
if (version_compare($ncVersion, '16.0.0', '>=')) { if (version_compare($ncVersion, '16.0.0', '>=')) {
$addressBookUri = $this->getAddressBookUri($entry->getProperty('addressbook-key')); $addressBookUri = $this->getAddressBookUri($entry->getProperty('addressbook-key'));
$iconUrl = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/info.svg')); $iconUrl = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/info.svg'));
@ -128,5 +127,4 @@ class DetailsProvider implements IProvider {
$entry->addAction($action); $entry->addAction($action);
} }
} }
} }

View File

@ -32,11 +32,10 @@ use OCP\L10N\IFactory;
use OCP\Util; use OCP\Util;
class PageController extends Controller { class PageController extends Controller {
protected $appName; protected $appName;
/** @var IConfig */ /** @var IConfig */
private $config; private $config;
/** @var IInitialStateService */ /** @var IInitialStateService */
private $initialStateService; private $initialStateService;

1930
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -47,6 +47,7 @@
"debounce": "^1.2.0", "debounce": "^1.2.0",
"downloadjs": "^1.4.7", "downloadjs": "^1.4.7",
"ical.js": "^1.4.0", "ical.js": "^1.4.0",
"moment": "^2.27.0",
"p-limit": "^2.3.0", "p-limit": "^2.3.0",
"p-queue": "^6.4.0", "p-queue": "^6.4.0",
"qr-image": "^3.2.0", "qr-image": "^3.2.0",

View File

@ -1,6 +1,6 @@
<?php <?php
if (\OCP\Util::isIe()) { if (\OCP\Util::isIe()) {
?> ?>
<div id="app-content"> <div id="app-content">
<div class="emptycontent"> <div class="emptycontent">
<div class="icon-contacts-dark"></div> <div class="icon-contacts-dark"></div>
@ -9,4 +9,5 @@ if (\OCP\Util::isIe()) {
</div> </div>
</div> </div>
<?php } ?> <?php
} ?>

View File

@ -105,69 +105,69 @@ class DetailsProviderTest extends Base {
$this->config->expects($this->at(0)) $this->config->expects($this->at(0))
->method('getSystemValue') ->method('getSystemValue')
->with('version', '0.0.0') ->with('version', '0.0.0')
->willReturn($version); ->willReturn($version);
$this->config->expects($this->at(1)) $this->config->expects($this->at(1))
->method('getSystemValue') ->method('getSystemValue')
->with('htaccess.IgnoreFrontController', false) ->with('htaccess.IgnoreFrontController', false)
->willReturn($frontControllerActive); ->willReturn($frontControllerActive);
$entry->expects($this->exactly(3)) $entry->expects($this->exactly(3))
->method('getProperty') ->method('getProperty')
->will($this->returnValueMap([ ->will($this->returnValueMap([
['UID', $uid], ['UID', $uid],
['isLocalSystemBook', null], ['isLocalSystemBook', null],
['addressbook-key', 1] ['addressbook-key', 1]
])); ]));
$addressbook->expects($this->once()) $addressbook->expects($this->once())
->method('getKey') ->method('getKey')
->willReturn(1); ->willReturn(1);
$addressbook->expects($this->once()) $addressbook->expects($this->once())
->method('getUri') ->method('getUri')
->willReturn($abUri); ->willReturn($abUri);
$this->manager->expects($this->once()) $this->manager->expects($this->once())
->method('getUserAddressbooks') ->method('getUserAddressbooks')
->willReturn([1 => $addressbook]); ->willReturn([1 => $addressbook]);
// Action icon // Action icon
$this->urlGenerator->expects($this->once()) $this->urlGenerator->expects($this->once())
->method('imagePath') ->method('imagePath')
->with('core', 'actions/info.svg') ->with('core', 'actions/info.svg')
->willReturn($iconUrl); ->willReturn($iconUrl);
// Action icon and contact absolute urls // Action icon and contact absolute urls
$this->urlGenerator->expects($this->exactly(2)) $this->urlGenerator->expects($this->exactly(2))
->method('getAbsoluteURL') ->method('getAbsoluteURL')
->will($this->returnValueMap([ ->will($this->returnValueMap([
[$iconUrl, "$domain/$iconUrl"], [$iconUrl, "$domain/$iconUrl"],
["$index/apps/contacts/$defaultGroup/$uid~$abUri", "$domain$index/apps/contacts/$defaultGroup/$uid~$abUri"] ["$index/apps/contacts/$defaultGroup/$uid~$abUri", "$domain$index/apps/contacts/$defaultGroup/$uid~$abUri"]
])); ]));
// Translations // Translations
$this->l10n->expects($this->at(0)) $this->l10n->expects($this->at(0))
->method('t') ->method('t')
->with($defaultGroup) ->with($defaultGroup)
->willReturn($defaultGroup); ->willReturn($defaultGroup);
$this->l10n->expects($this->at(1)) $this->l10n->expects($this->at(1))
->method('t') ->method('t')
->with('Details') ->with('Details')
->willReturnArgument(0); ->willReturnArgument(0);
$this->actionFactory->expects($this->once()) $this->actionFactory->expects($this->once())
->method('newLinkAction') ->method('newLinkAction')
->with($this->equalTo("$domain/$iconUrl"), $this->equalTo('Details'), $this->equalTo($resultUri)) ->with($this->equalTo("$domain/$iconUrl"), $this->equalTo('Details'), $this->equalTo($resultUri))
->willReturn($action); ->willReturn($action);
$action->expects($this->once()) $action->expects($this->once())
->method('setPriority') ->method('setPriority')
->with($this->equalTo(0)); ->with($this->equalTo(0));
$entry->expects($this->once()) $entry->expects($this->once())
->method('addAction') ->method('addAction')
->with($action); ->with($action);
$this->provider->process($entry); $this->provider->process($entry);
} }
@ -178,17 +178,17 @@ class DetailsProviderTest extends Base {
*/ */
public function testProcessNC15() { public function testProcessNC15() {
$this->config->expects($this->once()) $this->config->expects($this->once())
->method('getSystemValue') ->method('getSystemValue')
->with('version', '0.0.0') ->with('version', '0.0.0')
->willReturn('15.0.0.0'); ->willReturn('15.0.0.0');
$entry = $this->createMock(IEntry::class); $entry = $this->createMock(IEntry::class);
$entry->expects($this->exactly(2)) $entry->expects($this->exactly(2))
->method('getProperty') ->method('getProperty')
->will($this->returnValueMap([ ->will($this->returnValueMap([
['UID', 'e3a71614-c602-4eb5-9994-47eec551542b'], ['UID', 'e3a71614-c602-4eb5-9994-47eec551542b'],
['isLocalSystemBook', null] ['isLocalSystemBook', null]
])); ]));
$this->assertNull($this->provider->process($entry)); $this->assertNull($this->provider->process($entry));
} }
@ -196,11 +196,11 @@ class DetailsProviderTest extends Base {
public function testProcessNoUID() { public function testProcessNoUID() {
$entry = $this->createMock(IEntry::class); $entry = $this->createMock(IEntry::class);
$entry->expects($this->once()) $entry->expects($this->once())
->method('getProperty') ->method('getProperty')
->with($this->equalTo('UID')) ->with($this->equalTo('UID'))
->willReturn(null); ->willReturn(null);
$entry->expects($this->never()) $entry->expects($this->never())
->method('addAction'); ->method('addAction');
$this->provider->process($entry); $this->provider->process($entry);
} }
@ -208,15 +208,14 @@ class DetailsProviderTest extends Base {
public function testProcessSystemContact() { public function testProcessSystemContact() {
$entry = $this->createMock(IEntry::class); $entry = $this->createMock(IEntry::class);
$entry->expects($this->exactly(2)) $entry->expects($this->exactly(2))
->method('getProperty') ->method('getProperty')
->will($this->returnValueMap([ ->will($this->returnValueMap([
['UID', 1234], ['UID', 1234],
['isLocalSystemBook', true] ['isLocalSystemBook', true]
])); ]));
$entry->expects($this->never()) $entry->expects($this->never())
->method('addAction'); ->method('addAction');
$this->provider->process($entry); $this->provider->process($entry);
} }
} }

View File

@ -31,9 +31,7 @@ use OCP\IRequest;
use OCP\L10N\IFactory; use OCP\L10N\IFactory;
use ChristophWurst\Nextcloud\Testing\TestCase; use ChristophWurst\Nextcloud\Testing\TestCase;
class PageControllerTest extends TestCase { class PageControllerTest extends TestCase {
private $controller; private $controller;
/** @var IRequest|MockObject */ /** @var IRequest|MockObject */
@ -46,7 +44,7 @@ class PageControllerTest extends TestCase {
private $languageFactory; private $languageFactory;
/** @var IConfig|MockObject*/ /** @var IConfig|MockObject*/
private $config; private $config;
public function setUp() { public function setUp() {