mirror of https://github.com/nextcloud/contacts
Fix syntax
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
parent
73823f4507
commit
8cd975f325
|
@ -21,14 +21,14 @@
|
|||
*
|
||||
*/
|
||||
namespace OCA\Contacts\AppInfo;
|
||||
|
||||
use OCP\AppFramework\App;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\IL10N;
|
||||
use OCP\INavigationManager;
|
||||
|
||||
class Application extends App {
|
||||
|
||||
const APP_ID = 'contacts';
|
||||
public const APP_ID = 'contacts';
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct(self::APP_ID);
|
||||
|
@ -65,6 +65,5 @@ class Application extends App {
|
|||
// navigation or on the settings page of your app
|
||||
'name' => $l10n->t('Contacts'),
|
||||
]);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,13 +67,13 @@ class DetailsProvider implements IProvider {
|
|||
|
||||
/**
|
||||
* Return a list of the user's addressbooks unique uris
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
* @since 16.0.0
|
||||
*/
|
||||
protected function getAddressBooksUris(): Array {
|
||||
$result = array();
|
||||
foreach($this->manager->getUserAddressbooks() as $addressBook) {
|
||||
protected function getAddressBooksUris(): array {
|
||||
$result = [];
|
||||
foreach ($this->manager->getUserAddressbooks() as $addressBook) {
|
||||
$result[$addressBook->getKey()] = $addressBook->getUri();
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,6 @@ class DetailsProvider implements IProvider {
|
|||
// We need $this->manager->getAddressbooksUris() to add this function
|
||||
$ncVersion = $this->config->getSystemValue('version', '0.0.0');
|
||||
if (version_compare($ncVersion, '16.0.0', '>=')) {
|
||||
|
||||
$addressBookUri = $this->getAddressBookUri($entry->getProperty('addressbook-key'));
|
||||
|
||||
$iconUrl = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/info.svg'));
|
||||
|
@ -128,5 +127,4 @@ class DetailsProvider implements IProvider {
|
|||
$entry->addAction($action);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,11 +32,10 @@ use OCP\L10N\IFactory;
|
|||
use OCP\Util;
|
||||
|
||||
class PageController extends Controller {
|
||||
|
||||
protected $appName;
|
||||
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
private $config;
|
||||
|
||||
/** @var IInitialStateService */
|
||||
private $initialStateService;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -47,6 +47,7 @@
|
|||
"debounce": "^1.2.0",
|
||||
"downloadjs": "^1.4.7",
|
||||
"ical.js": "^1.4.0",
|
||||
"moment": "^2.27.0",
|
||||
"p-limit": "^2.3.0",
|
||||
"p-queue": "^6.4.0",
|
||||
"qr-image": "^3.2.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
if (\OCP\Util::isIe()) {
|
||||
?>
|
||||
?>
|
||||
<div id="app-content">
|
||||
<div class="emptycontent">
|
||||
<div class="icon-contacts-dark"></div>
|
||||
|
@ -9,4 +9,5 @@ if (\OCP\Util::isIe()) {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
<?php
|
||||
} ?>
|
||||
|
|
|
@ -105,69 +105,69 @@ class DetailsProviderTest extends Base {
|
|||
|
||||
|
||||
$this->config->expects($this->at(0))
|
||||
->method('getSystemValue')
|
||||
->with('version', '0.0.0')
|
||||
->willReturn($version);
|
||||
->method('getSystemValue')
|
||||
->with('version', '0.0.0')
|
||||
->willReturn($version);
|
||||
|
||||
$this->config->expects($this->at(1))
|
||||
->method('getSystemValue')
|
||||
->with('htaccess.IgnoreFrontController', false)
|
||||
->willReturn($frontControllerActive);
|
||||
->method('getSystemValue')
|
||||
->with('htaccess.IgnoreFrontController', false)
|
||||
->willReturn($frontControllerActive);
|
||||
|
||||
$entry->expects($this->exactly(3))
|
||||
->method('getProperty')
|
||||
->will($this->returnValueMap([
|
||||
['UID', $uid],
|
||||
['isLocalSystemBook', null],
|
||||
['addressbook-key', 1]
|
||||
]));
|
||||
->method('getProperty')
|
||||
->will($this->returnValueMap([
|
||||
['UID', $uid],
|
||||
['isLocalSystemBook', null],
|
||||
['addressbook-key', 1]
|
||||
]));
|
||||
|
||||
$addressbook->expects($this->once())
|
||||
->method('getKey')
|
||||
->willReturn(1);
|
||||
->method('getKey')
|
||||
->willReturn(1);
|
||||
|
||||
$addressbook->expects($this->once())
|
||||
->method('getUri')
|
||||
->willReturn($abUri);
|
||||
->method('getUri')
|
||||
->willReturn($abUri);
|
||||
|
||||
$this->manager->expects($this->once())
|
||||
->method('getUserAddressbooks')
|
||||
->willReturn([1 => $addressbook]);
|
||||
->method('getUserAddressbooks')
|
||||
->willReturn([1 => $addressbook]);
|
||||
|
||||
// Action icon
|
||||
$this->urlGenerator->expects($this->once())
|
||||
->method('imagePath')
|
||||
->with('core', 'actions/info.svg')
|
||||
->willReturn($iconUrl);
|
||||
->method('imagePath')
|
||||
->with('core', 'actions/info.svg')
|
||||
->willReturn($iconUrl);
|
||||
|
||||
// Action icon and contact absolute urls
|
||||
$this->urlGenerator->expects($this->exactly(2))
|
||||
->method('getAbsoluteURL')
|
||||
->will($this->returnValueMap([
|
||||
[$iconUrl, "$domain/$iconUrl"],
|
||||
["$index/apps/contacts/$defaultGroup/$uid~$abUri", "$domain$index/apps/contacts/$defaultGroup/$uid~$abUri"]
|
||||
]));
|
||||
->method('getAbsoluteURL')
|
||||
->will($this->returnValueMap([
|
||||
[$iconUrl, "$domain/$iconUrl"],
|
||||
["$index/apps/contacts/$defaultGroup/$uid~$abUri", "$domain$index/apps/contacts/$defaultGroup/$uid~$abUri"]
|
||||
]));
|
||||
|
||||
// Translations
|
||||
$this->l10n->expects($this->at(0))
|
||||
->method('t')
|
||||
->with($defaultGroup)
|
||||
->willReturn($defaultGroup);
|
||||
->method('t')
|
||||
->with($defaultGroup)
|
||||
->willReturn($defaultGroup);
|
||||
$this->l10n->expects($this->at(1))
|
||||
->method('t')
|
||||
->with('Details')
|
||||
->method('t')
|
||||
->with('Details')
|
||||
->willReturnArgument(0);
|
||||
|
||||
$this->actionFactory->expects($this->once())
|
||||
->method('newLinkAction')
|
||||
->with($this->equalTo("$domain/$iconUrl"), $this->equalTo('Details'), $this->equalTo($resultUri))
|
||||
->willReturn($action);
|
||||
->method('newLinkAction')
|
||||
->with($this->equalTo("$domain/$iconUrl"), $this->equalTo('Details'), $this->equalTo($resultUri))
|
||||
->willReturn($action);
|
||||
$action->expects($this->once())
|
||||
->method('setPriority')
|
||||
->with($this->equalTo(0));
|
||||
->method('setPriority')
|
||||
->with($this->equalTo(0));
|
||||
$entry->expects($this->once())
|
||||
->method('addAction')
|
||||
->with($action);
|
||||
->method('addAction')
|
||||
->with($action);
|
||||
|
||||
$this->provider->process($entry);
|
||||
}
|
||||
|
@ -178,17 +178,17 @@ class DetailsProviderTest extends Base {
|
|||
*/
|
||||
public function testProcessNC15() {
|
||||
$this->config->expects($this->once())
|
||||
->method('getSystemValue')
|
||||
->with('version', '0.0.0')
|
||||
->willReturn('15.0.0.0');
|
||||
->method('getSystemValue')
|
||||
->with('version', '0.0.0')
|
||||
->willReturn('15.0.0.0');
|
||||
|
||||
$entry = $this->createMock(IEntry::class);
|
||||
$entry->expects($this->exactly(2))
|
||||
->method('getProperty')
|
||||
->will($this->returnValueMap([
|
||||
['UID', 'e3a71614-c602-4eb5-9994-47eec551542b'],
|
||||
['isLocalSystemBook', null]
|
||||
]));
|
||||
->method('getProperty')
|
||||
->will($this->returnValueMap([
|
||||
['UID', 'e3a71614-c602-4eb5-9994-47eec551542b'],
|
||||
['isLocalSystemBook', null]
|
||||
]));
|
||||
|
||||
$this->assertNull($this->provider->process($entry));
|
||||
}
|
||||
|
@ -196,11 +196,11 @@ class DetailsProviderTest extends Base {
|
|||
public function testProcessNoUID() {
|
||||
$entry = $this->createMock(IEntry::class);
|
||||
$entry->expects($this->once())
|
||||
->method('getProperty')
|
||||
->with($this->equalTo('UID'))
|
||||
->willReturn(null);
|
||||
->method('getProperty')
|
||||
->with($this->equalTo('UID'))
|
||||
->willReturn(null);
|
||||
$entry->expects($this->never())
|
||||
->method('addAction');
|
||||
->method('addAction');
|
||||
|
||||
$this->provider->process($entry);
|
||||
}
|
||||
|
@ -208,15 +208,14 @@ class DetailsProviderTest extends Base {
|
|||
public function testProcessSystemContact() {
|
||||
$entry = $this->createMock(IEntry::class);
|
||||
$entry->expects($this->exactly(2))
|
||||
->method('getProperty')
|
||||
->will($this->returnValueMap([
|
||||
['UID', 1234],
|
||||
['isLocalSystemBook', true]
|
||||
]));
|
||||
->method('getProperty')
|
||||
->will($this->returnValueMap([
|
||||
['UID', 1234],
|
||||
['isLocalSystemBook', true]
|
||||
]));
|
||||
$entry->expects($this->never())
|
||||
->method('addAction');
|
||||
->method('addAction');
|
||||
|
||||
$this->provider->process($entry);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,9 +31,7 @@ use OCP\IRequest;
|
|||
use OCP\L10N\IFactory;
|
||||
use ChristophWurst\Nextcloud\Testing\TestCase;
|
||||
|
||||
|
||||
class PageControllerTest extends TestCase {
|
||||
|
||||
private $controller;
|
||||
|
||||
/** @var IRequest|MockObject */
|
||||
|
@ -46,7 +44,7 @@ class PageControllerTest extends TestCase {
|
|||
private $languageFactory;
|
||||
|
||||
/** @var IConfig|MockObject*/
|
||||
private $config;
|
||||
private $config;
|
||||
|
||||
|
||||
public function setUp() {
|
||||
|
|
Loading…
Reference in New Issue