cozy-sharing 27.1.3 → 27.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/components/SharedDrive/DumbSharedDriveModal.js +13 -2
- package/dist/components/SharedDrive/SharedDriveEditModal.js +60 -2
- package/locales/en.json +5 -1
- package/locales/fr.json +4 -1
- package/locales/ru.json +4 -1
- package/locales/vi.json +4 -1
- package/package.json +6 -6
- package/src/components/SharedDrive/DumbSharedDriveModal.jsx +16 -2
- package/src/components/SharedDrive/SharedDriveEditModal.jsx +29 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,20 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [27.2.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@27.1.4...cozy-sharing@27.2.0) (2025-12-04)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **cozy-sharing:** Lint command ([3d6474a](https://github.com/cozy/cozy-libs/commit/3d6474a857f51ee604e049a85c277482ab7d1756))
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
- **cozy-sharing:** Add rename feature to shared drive ([a0eb9ae](https://github.com/cozy/cozy-libs/commit/a0eb9ae336fe45888e05b078625ea9d14525cd48))
|
|
15
|
+
|
|
16
|
+
## [27.1.4](https://github.com/cozy/cozy-libs/compare/cozy-sharing@27.1.3...cozy-sharing@27.1.4) (2025-12-04)
|
|
17
|
+
|
|
18
|
+
**Note:** Version bump only for package cozy-sharing
|
|
19
|
+
|
|
6
20
|
## [27.1.3](https://github.com/cozy/cozy-libs/compare/cozy-sharing@27.1.2...cozy-sharing@27.1.3) (2025-12-04)
|
|
7
21
|
|
|
8
22
|
**Note:** Version bump only for package cozy-sharing
|
|
@@ -19,7 +19,9 @@ export var DumbSharedDriveModal = withLocales(function (_ref) {
|
|
|
19
19
|
onSetType = _ref.onSetType,
|
|
20
20
|
onCreate = _ref.onCreate,
|
|
21
21
|
onClose = _ref.onClose,
|
|
22
|
-
onShare = _ref.onShare
|
|
22
|
+
onShare = _ref.onShare,
|
|
23
|
+
onRename = _ref.onRename,
|
|
24
|
+
originalSharedDriveName = _ref.originalSharedDriveName;
|
|
23
25
|
|
|
24
26
|
var _useI18n = useI18n(),
|
|
25
27
|
t = _useI18n.t;
|
|
@@ -76,6 +78,13 @@ export var DumbSharedDriveModal = withLocales(function (_ref) {
|
|
|
76
78
|
variant: "primary",
|
|
77
79
|
label: t('SharedDrive.sharedDriveModal.create'),
|
|
78
80
|
onClick: onCreate
|
|
81
|
+
})), onRename && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
82
|
+
disabled: originalSharedDriveName === sharedDriveName,
|
|
83
|
+
variant: "primary",
|
|
84
|
+
label: t('SharedDrive.sharedDriveModal.save'),
|
|
85
|
+
onClick: function onClick() {
|
|
86
|
+
return onRename(sharedDriveName);
|
|
87
|
+
}
|
|
79
88
|
})))
|
|
80
89
|
});
|
|
81
90
|
});
|
|
@@ -90,5 +99,7 @@ DumbSharedDriveModal.propTypes = {
|
|
|
90
99
|
onSetType: PropTypes.func.isRequired,
|
|
91
100
|
onCreate: PropTypes.func.isRequired,
|
|
92
101
|
onClose: PropTypes.func.isRequired,
|
|
93
|
-
onShare: PropTypes.func.isRequired
|
|
102
|
+
onShare: PropTypes.func.isRequired,
|
|
103
|
+
onRename: PropTypes.func.isRequired,
|
|
104
|
+
originalSharedDriveName: PropTypes.string.isRequired
|
|
94
105
|
};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
1
4
|
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
5
|
+
import React, { useState } from 'react';
|
|
3
6
|
import { useClient } from 'cozy-client';
|
|
7
|
+
import { useAlert } from 'cozy-ui/transpiled/react/providers/Alert';
|
|
4
8
|
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
|
|
5
9
|
import { DumbSharedDriveModal } from './DumbSharedDriveModal';
|
|
6
10
|
import withLocales from '../../hoc/withLocales';
|
|
@@ -17,10 +21,60 @@ export var SharedDriveEditModal = withLocales(function (_ref) {
|
|
|
17
21
|
var _useI18n = useI18n(),
|
|
18
22
|
t = _useI18n.t;
|
|
19
23
|
|
|
24
|
+
var _useAlert = useAlert(),
|
|
25
|
+
showAlert = _useAlert.showAlert;
|
|
26
|
+
|
|
20
27
|
var createContact = function createContact(contact) {
|
|
21
28
|
return client.create(Contact.doctype, contact);
|
|
22
29
|
};
|
|
23
30
|
|
|
31
|
+
var _useState = useState(sharing === null || sharing === void 0 ? void 0 : sharing.description),
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
name = _useState2[0],
|
|
34
|
+
setName = _useState2[1];
|
|
35
|
+
|
|
36
|
+
var handleNameChange = function handleNameChange(event) {
|
|
37
|
+
setName(event.target.value);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
var onRename = /*#__PURE__*/function () {
|
|
41
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(value) {
|
|
42
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
43
|
+
while (1) switch (_context.prev = _context.next) {
|
|
44
|
+
case 0:
|
|
45
|
+
_context.prev = 0;
|
|
46
|
+
_context.next = 3;
|
|
47
|
+
return client.collection('io.cozy.sharings').renameSharedDrive(sharing, value);
|
|
48
|
+
|
|
49
|
+
case 3:
|
|
50
|
+
showAlert({
|
|
51
|
+
message: t('SharedDrive.sharedDriveModal.successNotificationUpdate'),
|
|
52
|
+
severity: 'success'
|
|
53
|
+
});
|
|
54
|
+
onClose();
|
|
55
|
+
_context.next = 10;
|
|
56
|
+
break;
|
|
57
|
+
|
|
58
|
+
case 7:
|
|
59
|
+
_context.prev = 7;
|
|
60
|
+
_context.t0 = _context["catch"](0);
|
|
61
|
+
showAlert({
|
|
62
|
+
message: t('SharedDrive.sharedDriveModal.errorNotificationUpdate'),
|
|
63
|
+
severity: 'error'
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
case 10:
|
|
67
|
+
case "end":
|
|
68
|
+
return _context.stop();
|
|
69
|
+
}
|
|
70
|
+
}, _callee, null, [[0, 7]]);
|
|
71
|
+
}));
|
|
72
|
+
|
|
73
|
+
return function onRename(_x) {
|
|
74
|
+
return _ref2.apply(this, arguments);
|
|
75
|
+
};
|
|
76
|
+
}();
|
|
77
|
+
|
|
24
78
|
return /*#__PURE__*/React.createElement(DumbSharedDriveModal, {
|
|
25
79
|
title: t('Files.share.title', {
|
|
26
80
|
name: sharing === null || sharing === void 0 ? void 0 : sharing.description
|
|
@@ -30,7 +84,11 @@ export var SharedDriveEditModal = withLocales(function (_ref) {
|
|
|
30
84
|
recipients: recipients,
|
|
31
85
|
onRevoke: onRevoke,
|
|
32
86
|
onClose: onClose,
|
|
33
|
-
onShare: onShare
|
|
87
|
+
onShare: onShare,
|
|
88
|
+
sharedDriveName: name,
|
|
89
|
+
handleSharedDriveNameChange: handleNameChange,
|
|
90
|
+
onRename: onRename,
|
|
91
|
+
originalSharedDriveName: sharing === null || sharing === void 0 ? void 0 : sharing.description
|
|
34
92
|
});
|
|
35
93
|
});
|
|
36
94
|
SharedDriveEditModal.propTypes = {
|
package/locales/en.json
CHANGED
|
@@ -463,9 +463,13 @@
|
|
|
463
463
|
"add": "Add",
|
|
464
464
|
"cancel": "Cancel",
|
|
465
465
|
"create": "Create",
|
|
466
|
+
"save": "Save",
|
|
466
467
|
"addPeople": "Add people to the shared drive :",
|
|
467
468
|
"successNotification": "Shared drive has been added",
|
|
468
|
-
"errorNotification": "Error during shared drive creation"
|
|
469
|
+
"errorNotification": "Error during shared drive creation",
|
|
470
|
+
"successNotificationUpdate": "Your shared drive has been modified",
|
|
471
|
+
"errorNotificationUpdate": "Error durring shared drive modification"
|
|
469
472
|
}
|
|
470
473
|
}
|
|
471
474
|
}
|
|
475
|
+
|
package/locales/fr.json
CHANGED
|
@@ -461,9 +461,12 @@
|
|
|
461
461
|
"add": "Ajouter",
|
|
462
462
|
"cancel": "Annuler",
|
|
463
463
|
"create": "Créer",
|
|
464
|
+
"save": "Enregistrer",
|
|
464
465
|
"addPeople": "Ajouter des utilisateurs au drive partagé :",
|
|
465
466
|
"successNotification": "Le drive partagé a été ajouté",
|
|
466
|
-
"errorNotification": "Erreur lors de la création du drive partagé"
|
|
467
|
+
"errorNotification": "Erreur lors de la création du drive partagé",
|
|
468
|
+
"successNotificationUpdate": "Votre drive partagé a été modifié",
|
|
469
|
+
"errorNotificationUpdate": "Erreur lors de la modification du drive partagé"
|
|
467
470
|
}
|
|
468
471
|
}
|
|
469
472
|
}
|
package/locales/ru.json
CHANGED
|
@@ -463,9 +463,12 @@
|
|
|
463
463
|
"add": "Добавить",
|
|
464
464
|
"cancel": "Отмена",
|
|
465
465
|
"create": "Создать",
|
|
466
|
+
"save": "Сохранить",
|
|
466
467
|
"addPeople": "Добавить людей в общий диск:",
|
|
467
468
|
"successNotification": "Общий диск добавлен",
|
|
468
|
-
"errorNotification": "Ошибка при создании общего диска"
|
|
469
|
+
"errorNotification": "Ошибка при создании общего диска",
|
|
470
|
+
"successNotificationUpdate": "Ваш общий диск был изменён",
|
|
471
|
+
"errorNotificationUpdate": "Ошибка при модификации общего диска"
|
|
469
472
|
}
|
|
470
473
|
}
|
|
471
474
|
}
|
package/locales/vi.json
CHANGED
|
@@ -461,9 +461,12 @@
|
|
|
461
461
|
"add": "Thêm",
|
|
462
462
|
"cancel": "Hủy",
|
|
463
463
|
"create": "Tạo",
|
|
464
|
+
"save": "Lưu",
|
|
464
465
|
"addPeople": "Thêm người vào ổ đĩa được chia sẻ:",
|
|
465
466
|
"successNotification": "Ổ đĩa được chia sẻ đã được thêm",
|
|
466
|
-
"errorNotification": "Lỗi trong quá trình tạo ổ đĩa được chia sẻ"
|
|
467
|
+
"errorNotification": "Lỗi trong quá trình tạo ổ đĩa được chia sẻ",
|
|
468
|
+
"successNotificationUpdate": "Ổ đĩa được chia sẻ của bạn đã được sửa đổi",
|
|
469
|
+
"errorNotificationUpdate": "Lỗi khi sửa đổi ổ đĩa được chia sẻ"
|
|
467
470
|
}
|
|
468
471
|
}
|
|
469
472
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-sharing",
|
|
3
|
-
"version": "27.
|
|
3
|
+
"version": "27.2.0",
|
|
4
4
|
"description": "Provides sharing login for React applications.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "Cozy",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"deploy:doc": "(cd ../.. && yarn deploy:doc)",
|
|
21
21
|
"prepublishOnly": "yarn build",
|
|
22
22
|
"test": "env NODE_ENV=test jest",
|
|
23
|
-
"lint": "cd
|
|
23
|
+
"lint": "cd ../.. && yarn eslint --ext js,jsx packages/cozy-sharing",
|
|
24
24
|
"start": "yarn build --watch",
|
|
25
25
|
"watch": "yarn run start",
|
|
26
26
|
"watch:doc:react": "(cd ../.. && TARGET=cozy-sharing yarn watch:doc:react)",
|
|
@@ -54,12 +54,12 @@
|
|
|
54
54
|
"babel-jest": "26.6.3",
|
|
55
55
|
"babel-plugin-css-modules-transform": "1.6.2",
|
|
56
56
|
"babel-plugin-inline-react-svg": "1.1.2",
|
|
57
|
-
"cozy-client": "^60.
|
|
57
|
+
"cozy-client": "^60.19.0",
|
|
58
58
|
"cozy-device-helper": "^3.7.1",
|
|
59
59
|
"cozy-intent": "^2.30.1",
|
|
60
60
|
"cozy-minilog": "^3.10.0",
|
|
61
61
|
"cozy-ui": "^128.3.5",
|
|
62
|
-
"cozy-ui-plus": "^3.1.
|
|
62
|
+
"cozy-ui-plus": "^3.1.2",
|
|
63
63
|
"jest": "26.6.3",
|
|
64
64
|
"jest-environment-jsdom": "26.6.2",
|
|
65
65
|
"react": "16.12.0",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"storybook": "7.6.0"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
|
-
"cozy-client": ">=60.
|
|
71
|
+
"cozy-client": ">=60.19.0",
|
|
72
72
|
"cozy-device-helper": ">=3.7.1",
|
|
73
73
|
"cozy-intent": ">=2.29.1",
|
|
74
74
|
"cozy-minilog": ">=3.9.1",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"sideEffects": [
|
|
82
82
|
"*.css"
|
|
83
83
|
],
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "f9a5c03a4a2bbf9b6bb2c83485f1baeedb09f462"
|
|
85
85
|
}
|
|
@@ -23,7 +23,9 @@ export const DumbSharedDriveModal = withLocales(
|
|
|
23
23
|
onSetType,
|
|
24
24
|
onCreate,
|
|
25
25
|
onClose,
|
|
26
|
-
onShare
|
|
26
|
+
onShare,
|
|
27
|
+
onRename,
|
|
28
|
+
originalSharedDriveName
|
|
27
29
|
}) => {
|
|
28
30
|
const { t } = useI18n()
|
|
29
31
|
|
|
@@ -92,6 +94,16 @@ export const DumbSharedDriveModal = withLocales(
|
|
|
92
94
|
/>
|
|
93
95
|
</>
|
|
94
96
|
)}
|
|
97
|
+
{onRename && (
|
|
98
|
+
<>
|
|
99
|
+
<Button
|
|
100
|
+
disabled={originalSharedDriveName === sharedDriveName}
|
|
101
|
+
variant="primary"
|
|
102
|
+
label={t('SharedDrive.sharedDriveModal.save')}
|
|
103
|
+
onClick={() => onRename(sharedDriveName)}
|
|
104
|
+
/>
|
|
105
|
+
</>
|
|
106
|
+
)}
|
|
95
107
|
</>
|
|
96
108
|
}
|
|
97
109
|
/>
|
|
@@ -110,5 +122,7 @@ DumbSharedDriveModal.propTypes = {
|
|
|
110
122
|
onSetType: PropTypes.func.isRequired,
|
|
111
123
|
onCreate: PropTypes.func.isRequired,
|
|
112
124
|
onClose: PropTypes.func.isRequired,
|
|
113
|
-
onShare: PropTypes.func.isRequired
|
|
125
|
+
onShare: PropTypes.func.isRequired,
|
|
126
|
+
onRename: PropTypes.func.isRequired,
|
|
127
|
+
originalSharedDriveName: PropTypes.string.isRequired
|
|
114
128
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import PropTypes from 'prop-types'
|
|
2
|
-
import React from 'react'
|
|
2
|
+
import React, { useState } from 'react'
|
|
3
3
|
|
|
4
4
|
import { useClient } from 'cozy-client'
|
|
5
|
+
import { useAlert } from 'cozy-ui/transpiled/react/providers/Alert'
|
|
5
6
|
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
|
|
6
7
|
|
|
7
8
|
import { DumbSharedDriveModal } from './DumbSharedDriveModal'
|
|
@@ -12,8 +13,31 @@ export const SharedDriveEditModal = withLocales(
|
|
|
12
13
|
({ document, sharing, recipients, onShare, onRevoke, onClose }) => {
|
|
13
14
|
const client = useClient()
|
|
14
15
|
const { t } = useI18n()
|
|
16
|
+
const { showAlert } = useAlert()
|
|
15
17
|
|
|
16
18
|
const createContact = contact => client.create(Contact.doctype, contact)
|
|
19
|
+
const [name, setName] = useState(sharing?.description)
|
|
20
|
+
|
|
21
|
+
const handleNameChange = event => {
|
|
22
|
+
setName(event.target.value)
|
|
23
|
+
}
|
|
24
|
+
const onRename = async value => {
|
|
25
|
+
try {
|
|
26
|
+
await client
|
|
27
|
+
.collection('io.cozy.sharings')
|
|
28
|
+
.renameSharedDrive(sharing, value)
|
|
29
|
+
showAlert({
|
|
30
|
+
message: t('SharedDrive.sharedDriveModal.successNotificationUpdate'),
|
|
31
|
+
severity: 'success'
|
|
32
|
+
})
|
|
33
|
+
onClose()
|
|
34
|
+
} catch (error) {
|
|
35
|
+
showAlert({
|
|
36
|
+
message: t('SharedDrive.sharedDriveModal.errorNotificationUpdate'),
|
|
37
|
+
severity: 'error'
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
}
|
|
17
41
|
|
|
18
42
|
return (
|
|
19
43
|
<DumbSharedDriveModal
|
|
@@ -24,6 +48,10 @@ export const SharedDriveEditModal = withLocales(
|
|
|
24
48
|
onRevoke={onRevoke}
|
|
25
49
|
onClose={onClose}
|
|
26
50
|
onShare={onShare}
|
|
51
|
+
sharedDriveName={name}
|
|
52
|
+
handleSharedDriveNameChange={handleNameChange}
|
|
53
|
+
onRename={onRename}
|
|
54
|
+
originalSharedDriveName={sharing?.description}
|
|
27
55
|
/>
|
|
28
56
|
)
|
|
29
57
|
}
|