Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Circles integration #2098

Merged
merged 17 commits into from
Jun 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
module.exports = {
globals: {
appVersion: true
appVersion: true,
},

plugins: ['import'],
extends: ['@nextcloud'],

settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import/resolver': {
typescript: {
alwaysTryTypes: true,
paths: './tsconfig.json',
},
},
},
extends: [
'@nextcloud'
]
}
4 changes: 2 additions & 2 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* 🙈 **We’re not reinventing the wheel!** Based on the great and open SabreDAV library.
</description>

<version>3.5.1</version>
<version>4.0.0-alpha.0</version>
<licence>agpl</licence>

<author>John Molakvoæ</author>
Expand All @@ -39,7 +39,7 @@
</types>

<dependencies>
<nextcloud min-version="19" max-version="22" />
<nextcloud min-version="20" max-version="22" />
</dependencies>

<contactsmenu>
Expand Down
3 changes: 2 additions & 1 deletion appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@

return [
'routes' => [
['name' => 'contacts#direct', 'url' => '/direct/{contact}', 'verb' => 'GET'],
['name' => 'contacts#direct', 'url' => '/direct/contact/{contact}', 'verb' => 'GET'],
['name' => 'contacts#directcircle', 'url' => '/direct/circle/{singleId}', 'verb' => 'GET'],
['name' => 'page#index', 'url' => '/', 'verb' => 'GET'],
['name' => 'page#index', 'url' => '/{group}', 'verb' => 'GET', 'postfix' => 'group'],
['name' => 'page#index', 'url' => '/{group}/{contact}', 'verb' => 'GET', 'postfix' => 'group.contact'],
Expand Down
17 changes: 3 additions & 14 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
module.exports = {
plugins: [
'@babel/plugin-syntax-dynamic-import',
],
presets: [
[
'@babel/preset-env',
{
corejs: 3,
useBuiltIns: 'entry',
},
],
],
}
const babelConfig = require('@nextcloud/babel-config')

module.exports = babelConfig
25 changes: 25 additions & 0 deletions css/contacts.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ $grid-height-unit: 40px;
$grid-input-padding: 7px;
$grid-input-margin: 3px;
$grid-input-height-with-margin: $grid-height-unit - $grid-input-margin * 2;
$list-width: 300px;

// components
@import 'SettingsSection';
Expand All @@ -38,3 +39,27 @@ $grid-input-height-with-margin: $grid-height-unit - $grid-input-margin * 2;
// various
@import 'animations';
@import 'icons';


// global design overrides
#app-content-wrapper {
display: flex;
}

.app-content-details {
// Starts shrinking at the same width as the list
flex: 1 1 $list-width;
min-width: 0;
padding: 0 80px 80px 80px;
}

.app-content-list {
flex: 1 1 $list-width;
// Cancel scrolling
overflow: visible;

// Make sure we don't show extra margins
.empty-content {
padding: 20px;
}
}
2 changes: 2 additions & 0 deletions css/icons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
@include icon-black-white('clone', 'contacts', 2);
@include icon-black-white('sync', 'contacts', 2);
@include icon-black-white('recent-actors', 'contacts', 1);
@include icon-black-white('circles', 'contacts', 1);
@include icon-black-white('contacts', 'contacts', 1);

// social network icons:
@include icon-black-white('facebook', 'contacts', 2); // “facebook (fab)” by fontawesome.com is licensed under CC BY 4.0. (https://fontawesome.com/icons/facebook?style=brands)
Expand Down
1 change: 1 addition & 0 deletions img/circles.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 11 additions & 19 deletions lib/ContactsMenu/Providers/DetailsProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
use OCP\Contacts\ContactsMenu\IEntry;
use OCP\Contacts\ContactsMenu\IProvider;
use OCP\Contacts\IManager;
use OCP\IConfig;
use OCP\IL10N;
use OCP\IURLGenerator;

Expand All @@ -46,23 +45,18 @@ class DetailsProvider implements IProvider {
/** @var IManager */
private $manager;

/** @var IConfig */
private $config;

/**
* @param IURLGenerator $urlGenerator
* @param IActionFactory $actionFactory
*/
public function __construct(IURLGenerator $urlGenerator,
IActionFactory $actionFactory,
IL10N $l10n,
IManager $manager,
IConfig $config) {
IManager $manager) {
$this->actionFactory = $actionFactory;
$this->urlGenerator = $urlGenerator;
$this->l10n = $l10n;
$this->manager = $manager;
$this->config = $config;
}

/**
Expand Down Expand Up @@ -111,20 +105,18 @@ public function process(IEntry $entry) {
return;
}

// 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'));
$addressBookUri = $this->getAddressBookUri($entry->getProperty('addressbook-key'));

$iconUrl = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/info.svg'));
$url = $this->l10n->t('All contacts') . '/' . $uid . '~' . $addressBookUri;
$iconUrl = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/info.svg'));

$frontControllerActive = ($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true');
$contactsUrl = $this->urlGenerator->getAbsoluteURL(($frontControllerActive ? '' : '/index.php') . '/apps/contacts/' . $url);
$contactsUrl = $this->urlGenerator->getAbsoluteURL(
$this->urlGenerator->linkToRoute('contacts.contacts.direct', [
'contact' => $uid . '~' . $addressBookUri
])
);

$action = $this->actionFactory->newLinkAction($iconUrl, $this->l10n->t('Details'), $contactsUrl);
$action->setPriority(0);
$entry->addAction($action);
}
$action = $this->actionFactory->newLinkAction($iconUrl, $this->l10n->t('Details'), $contactsUrl);
$action->setPriority(0);
$entry->addAction($action);
}
}
15 changes: 15 additions & 0 deletions lib/Controller/ContactsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,19 @@ public function direct(string $contact): RedirectResponse {
);
return new RedirectResponse($url);
}


/**
* @NoAdminRequired
* @NoCSRFRequired
*
* Open and find direct circle
* @param string $uuid
*/
public function directCircle(string $singleId): RedirectResponse {
$url = $this->urlGenerator->getAbsoluteURL(
$this->urlGenerator->linkToRoute('contacts.page.index') . 'circle/' . $singleId
);
return new RedirectResponse($url);
}
}
Loading