summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2021-08-18 11:31:01 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2021-08-18 11:51:33 +0200
commit4d112fdb83abc07a3ff905dcf012aa09ef704daa (patch)
tree8b2afc90dafb5606649c3a55f2454423a31f8681
parent1e89b3b22086b63499fe5403e9e083d741398249 (diff)
Use sharing constants from a package, not another app
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
-rw-r--r--package-lock.json20
-rw-r--r--package.json1
-rw-r--r--src/models/constants.d.ts3
-rw-r--r--src/models/constants.ts36
4 files changed, 38 insertions, 22 deletions
diff --git a/package-lock.json b/package-lock.json
index b5539fa5..7191c7c3 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -5,6 +5,7 @@
"requires": true,
"packages": {
"": {
+ "name": "contacts",
"version": "4.0.1",
"license": "agpl",
"dependencies": {
@@ -20,6 +21,7 @@
"@nextcloud/moment": "^1.1.1",
"@nextcloud/paths": "^2.0.0",
"@nextcloud/router": "^2.0.0",
+ "@nextcloud/sharing": "^0.1.0",
"@nextcloud/vue": "^4.0.3",
"b64-to-blob": "^1.2.19",
"camelcase": "^6.2.0",
@@ -2270,6 +2272,14 @@
"core-js": "^3.6.4"
}
},
+ "node_modules/@nextcloud/sharing": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/@nextcloud/sharing/-/sharing-0.1.0.tgz",
+ "integrity": "sha512-Cv4uc1aFrA18w0dltq7a5om/EbJSXf36rtO0LP3vi42E6l8ZDVCZwHLKrsZZa/TXNLeYErs1g/6tmWx5xiSSow==",
+ "dependencies": {
+ "core-js": "^3.6.4"
+ }
+ },
"node_modules/@nextcloud/stylelint-config": {
"version": "1.0.0-beta.0",
"integrity": "sha512-9k3/bV4jLwOBTQLmbP+E9ER8vrZ9sZsl5UFLnlapM34qedu7a0FW8eYSUCtzJYjYIdvH52QEHODLERhPXxS/cQ==",
@@ -16695,6 +16705,14 @@
"core-js": "^3.6.4"
}
},
+ "@nextcloud/sharing": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/@nextcloud/sharing/-/sharing-0.1.0.tgz",
+ "integrity": "sha512-Cv4uc1aFrA18w0dltq7a5om/EbJSXf36rtO0LP3vi42E6l8ZDVCZwHLKrsZZa/TXNLeYErs1g/6tmWx5xiSSow==",
+ "requires": {
+ "core-js": "^3.6.4"
+ }
+ },
"@nextcloud/stylelint-config": {
"version": "1.0.0-beta.0",
"integrity": "sha512-9k3/bV4jLwOBTQLmbP+E9ER8vrZ9sZsl5UFLnlapM34qedu7a0FW8eYSUCtzJYjYIdvH52QEHODLERhPXxS/cQ==",
@@ -18095,7 +18113,7 @@
"cdav-library": {
"version": "git+ssh://git@github.com/nextcloud/cdav-library.git#935b1513937eb205efd459ed9fa0203a1429f643",
"integrity": "sha512-OHaUpQtG0toaOFBhOVnEhqwv48SRNUzoYqXKwQ0aG9MWTcsrcRTBowGrt/VlnQAm3Y+pGe3IYOU9XKatBdg9UA==",
- "from": "cdav-library@git+https://github.com/nextcloud/cdav-library.git#935b1513937eb205efd459ed9fa0203a1429f643",
+ "from": "cdav-library@git+https://github.com/nextcloud/cdav-library.git",
"requires": {
"core-js": "^3.16.1",
"regenerator-runtime": "^0.13.9"
diff --git a/package.json b/package.json
index 24b4d756..73c59523 100644
--- a/package.json
+++ b/package.json
@@ -45,6 +45,7 @@
"@nextcloud/moment": "^1.1.1",
"@nextcloud/paths": "^2.0.0",
"@nextcloud/router": "^2.0.0",
+ "@nextcloud/sharing": "^0.1.0",
"@nextcloud/vue": "^4.0.3",
"b64-to-blob": "^1.2.19",
"camelcase": "^6.2.0",
diff --git a/src/models/constants.d.ts b/src/models/constants.d.ts
index e9532cf2..e4f06e6d 100644
--- a/src/models/constants.d.ts
+++ b/src/models/constants.d.ts
@@ -19,6 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
+import { Type } from '@nextcloud/sharing';
export declare type DefaultGroup = string;
export declare type CircleConfig = number;
export declare type MemberLevel = number;
@@ -44,7 +45,7 @@ export declare const PUBLIC_CIRCLE_CONFIG: {
export declare const CIRCLES_MEMBER_GROUPING: {
id: string;
label: string;
- share: any;
+ share: Type;
type: number;
}[];
export declare const SHARES_TYPES_MEMBER_MAP: {};
diff --git a/src/models/constants.ts b/src/models/constants.ts
index 856d8209..68e473f4 100644
--- a/src/models/constants.ts
+++ b/src/models/constants.ts
@@ -22,11 +22,7 @@
/// <reference types="@nextcloud/typings" />
import { translate as t } from '@nextcloud/l10n'
-
-interface OC extends Nextcloud.Common.OC {
- Share: any
-}
-declare const OC: OC
+import { Type } from '@nextcloud/sharing'
export type DefaultGroup = string
export type CircleConfig = number
@@ -121,56 +117,56 @@ export const PUBLIC_CIRCLE_CONFIG = {
}
-// Represents the picker options but also the
+// Represents the picker options but also the
// sorting of the members list
export const CIRCLES_MEMBER_GROUPING = [
{
- id: `picker-${OC.Share.SHARE_TYPE_USER}`,
+ id: `picker-${Type.SHARE_TYPE_USER}`,
label: t('contacts', 'Users'),
- share: OC.Share.SHARE_TYPE_USER,
+ share: Type.SHARE_TYPE_USER,
type: MEMBER_TYPE_USER
},
{
- id: `picker-${OC.Share.SHARE_TYPE_GROUP}`,
+ id: `picker-${Type.SHARE_TYPE_GROUP}`,
label: t('contacts', 'Groups'),
- share: OC.Share.SHARE_TYPE_GROUP,
+ share: Type.SHARE_TYPE_GROUP,
type: MEMBER_TYPE_GROUP
},
// TODO: implement federated
// {
- // id: `picker-${OC.Share.SHARE_TYPE_REMOTE}`,
+ // id: `picker-${Type.SHARE_TYPE_REMOTE}`,
// label: t('contacts', 'Federated users'),
- // share: OC.Share.SHARE_TYPE_REMOTE,
+ // share: Type.SHARE_TYPE_REMOTE,
// type: MEMBER_TYPE_USER
// },
// {
- // id: `picker-${OC.Share.SHARE_TYPE_REMOTE_GROUP}`,
+ // id: `picker-${Type.SHARE_TYPE_REMOTE_GROUP}`,
// label: t('contacts', 'Federated groups'),
- // share: OC.Share.SHARE_TYPE_REMOTE_GROUP,
+ // share: Type.SHARE_TYPE_REMOTE_GROUP,
// type: MEMBER_TYPE_GROUP
// },
{
- id: `picker-${OC.Share.SHARE_TYPE_CIRCLE}`,
+ id: `picker-${Type.SHARE_TYPE_CIRCLE}`,
label: t('contacts', 'Circles'),
- share: OC.Share.SHARE_TYPE_CIRCLE,
+ share: Type.SHARE_TYPE_CIRCLE,
type: MEMBER_TYPE_CIRCLE
},
{
- id: `picker-${OC.Share.SHARE_TYPE_EMAIL}`,
+ id: `picker-${Type.SHARE_TYPE_EMAIL}`,
label: t('contacts', 'Emails'),
- share: OC.Share.SHARE_TYPE_EMAIL,
+ share: Type.SHARE_TYPE_EMAIL,
type: MEMBER_TYPE_MAIL
},
// TODO: implement SHARE_TYPE_CONTACT
{
id: `picker-contact`,
label: t('contacts', 'Contacts'),
- share: OC.Share.SHARE_TYPE_EMAIL,
+ share: Type.SHARE_TYPE_EMAIL,
type: MEMBER_TYPE_CONTACT
},
]
-// Generating a map between share types and circle member types
+// Generating a map between share types and circle member types
export const SHARES_TYPES_MEMBER_MAP = CIRCLES_MEMBER_GROUPING.reduce((list, entry) => {
// ! Ignore duplicate share types
if (!list[entry.share]) {