cozy-sharing 6.0.3 → 6.0.4
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 +11 -0
- package/dist/SharingBanner/hooks/useSharingInfos.js +35 -37
- package/dist/SharingBanner/hooks/useSharingInfos.spec.js +40 -44
- package/dist/SharingProvider.js +351 -375
- package/dist/SharingProvider.spec.js +29 -33
- package/dist/components/CozyPassFingerprintDialogContent.spec.js +14 -16
- package/dist/components/Recipient/LinkRecipientPermissions.js +25 -27
- package/dist/components/Recipient/Recipient.spec.js +39 -43
- package/dist/components/Recipient/RecipientPermissions.js +20 -22
- package/dist/components/ShareButton.js +0 -2
- package/dist/components/ShareByEmail.js +53 -55
- package/dist/components/ShareByEmail.spec.js +50 -52
- package/dist/components/ShareByLink.js +73 -79
- package/dist/components/ShareDialogCozyToCozy.spec.js +238 -264
- package/dist/components/ShareDialogTwoStepsConfirmationContainer.js +33 -35
- package/dist/components/ShareDialogTwoStepsConfirmationContainer.spec.js +240 -266
- package/dist/components/SharedBadge.js +0 -2
- package/dist/components/badge.styl +7 -5
- package/dist/components/button.styl +11 -12
- package/dist/components/useFetchDocumentPath.js +16 -18
- package/dist/fetchNextPermissions.js +15 -17
- package/dist/getSharedDocument.js +13 -15
- package/dist/getSharedDocument.spec.js +10 -12
- package/dist/helpers/contacts.js +65 -69
- package/dist/helpers/contacts.spec.js +30 -32
- package/dist/helpers/files.js +26 -28
- package/dist/helpers/files.spec.js +54 -58
- package/dist/helpers/sharings.js +56 -60
- package/dist/helpers/synchronousJobQueue.js +19 -21
- package/dist/helpers/synchronousJobQueue.spec.js +39 -43
- package/dist/stylesheet.css +28 -820
- package/package.json +2 -2
- package/src/components/badge.styl +7 -5
- package/src/components/button.styl +11 -12
package/dist/SharingProvider.js
CHANGED
|
@@ -72,34 +72,32 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
72
72
|
var _this$props, client, doctype, internalSharing, newSharing, docsId;
|
|
73
73
|
|
|
74
74
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
75
|
-
while (1) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
75
|
+
while (1) switch (_context.prev = _context.next) {
|
|
76
|
+
case 0:
|
|
77
|
+
_this$props = _this.props, client = _this$props.client, doctype = _this$props.doctype;
|
|
78
|
+
internalSharing = getSharingById(_this.state, sharing._id);
|
|
79
|
+
newSharing = getSharingObject(internalSharing, sharing);
|
|
80
|
+
|
|
81
|
+
if (internalSharing) {
|
|
82
|
+
updateSharingInStore(_this.dispatch, newSharing);
|
|
83
|
+
} else {
|
|
84
|
+
docsId = getSharingDocIds(newSharing);
|
|
85
|
+
|
|
86
|
+
_this.synchronousJobQueue.push({
|
|
87
|
+
function: createSharingInStore,
|
|
88
|
+
arguments: {
|
|
89
|
+
client: client,
|
|
90
|
+
doctype: doctype,
|
|
91
|
+
dispatch: _this.dispatch,
|
|
92
|
+
docsId: docsId,
|
|
93
|
+
sharing: newSharing
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
98
97
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
98
|
+
case 4:
|
|
99
|
+
case "end":
|
|
100
|
+
return _context.stop();
|
|
103
101
|
}
|
|
104
102
|
}, _callee);
|
|
105
103
|
}));
|
|
@@ -116,88 +114,86 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
116
114
|
var document, recipients, readOnlyRecipients, description, openSharing, _this$props2, client, doctype, sharing, sharingResult, previewPath, _yield$_this$sharingC, data;
|
|
117
115
|
|
|
118
116
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
119
|
-
while (1) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
return _context2.stop();
|
|
200
|
-
}
|
|
117
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
118
|
+
case 0:
|
|
119
|
+
document = _ref2.document, recipients = _ref2.recipients, readOnlyRecipients = _ref2.readOnlyRecipients, description = _ref2.description, openSharing = _ref2.openSharing;
|
|
120
|
+
_this$props2 = _this.props, client = _this$props2.client, doctype = _this$props2.doctype;
|
|
121
|
+
sharing = getDocumentSharing(_this.state, document.id);
|
|
122
|
+
|
|
123
|
+
if (!sharing) {
|
|
124
|
+
_context2.next = 10;
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
_context2.next = 6;
|
|
129
|
+
return _this.addRecipients({
|
|
130
|
+
document: sharing,
|
|
131
|
+
recipients: recipients,
|
|
132
|
+
readOnlyRecipients: readOnlyRecipients
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
case 6:
|
|
136
|
+
sharingResult = _context2.sent;
|
|
137
|
+
_context2.next = 9;
|
|
138
|
+
return _this.state.onShared({
|
|
139
|
+
document: document,
|
|
140
|
+
recipients: recipients,
|
|
141
|
+
readOnlyRecipients: readOnlyRecipients
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
case 9:
|
|
145
|
+
return _context2.abrupt("return", sharingResult);
|
|
146
|
+
|
|
147
|
+
case 10:
|
|
148
|
+
previewPath = (_this$props$previewPa = _this.props.previewPath) !== null && _this$props$previewPa !== void 0 ? _this$props$previewPa : '/preview';
|
|
149
|
+
_context2.next = 13;
|
|
150
|
+
return _this.sharingCol.create({
|
|
151
|
+
document: document,
|
|
152
|
+
recipients: recipients,
|
|
153
|
+
readOnlyRecipients: readOnlyRecipients,
|
|
154
|
+
description: description,
|
|
155
|
+
previewPath: previewPath,
|
|
156
|
+
openSharing: openSharing
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
case 13:
|
|
160
|
+
_yield$_this$sharingC = _context2.sent;
|
|
161
|
+
data = _yield$_this$sharingC.data;
|
|
162
|
+
_context2.t0 = _this;
|
|
163
|
+
_context2.t1 = addSharing;
|
|
164
|
+
_context2.t2 = data;
|
|
165
|
+
_context2.t3 = document.path;
|
|
166
|
+
|
|
167
|
+
if (_context2.t3) {
|
|
168
|
+
_context2.next = 23;
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
_context2.next = 22;
|
|
173
|
+
return fetchFilesPaths(client, doctype, [document]);
|
|
174
|
+
|
|
175
|
+
case 22:
|
|
176
|
+
_context2.t3 = _context2.sent;
|
|
177
|
+
|
|
178
|
+
case 23:
|
|
179
|
+
_context2.t4 = _context2.t3;
|
|
180
|
+
_context2.t5 = (0, _context2.t1)(_context2.t2, _context2.t4);
|
|
181
|
+
|
|
182
|
+
_context2.t0.dispatch.call(_context2.t0, _context2.t5);
|
|
183
|
+
|
|
184
|
+
_context2.next = 28;
|
|
185
|
+
return _this.state.onShared({
|
|
186
|
+
document: document,
|
|
187
|
+
recipients: recipients,
|
|
188
|
+
readOnlyRecipients: readOnlyRecipients
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
case 28:
|
|
192
|
+
return _context2.abrupt("return", data);
|
|
193
|
+
|
|
194
|
+
case 29:
|
|
195
|
+
case "end":
|
|
196
|
+
return _context2.stop();
|
|
201
197
|
}
|
|
202
198
|
}, _callee2);
|
|
203
199
|
}));
|
|
@@ -211,26 +207,24 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
211
207
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref4) {
|
|
212
208
|
var document, recipients, readOnlyRecipients, resp;
|
|
213
209
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
214
|
-
while (1) {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
return _context3.stop();
|
|
233
|
-
}
|
|
210
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
211
|
+
case 0:
|
|
212
|
+
document = _ref4.document, recipients = _ref4.recipients, readOnlyRecipients = _ref4.readOnlyRecipients;
|
|
213
|
+
_context3.next = 3;
|
|
214
|
+
return _this.sharingCol.addRecipients({
|
|
215
|
+
document: document,
|
|
216
|
+
recipients: recipients,
|
|
217
|
+
readOnlyRecipients: readOnlyRecipients
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
case 3:
|
|
221
|
+
resp = _context3.sent;
|
|
222
|
+
|
|
223
|
+
_this.dispatch(updateSharing(resp.data));
|
|
224
|
+
|
|
225
|
+
case 5:
|
|
226
|
+
case "end":
|
|
227
|
+
return _context3.stop();
|
|
234
228
|
}
|
|
235
229
|
}, _callee3);
|
|
236
230
|
}));
|
|
@@ -245,62 +239,58 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
245
239
|
var _this$props3, client, doctype, recipients, sharing;
|
|
246
240
|
|
|
247
241
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
248
|
-
while (1) {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
_context4.next = 9;
|
|
272
|
-
break;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
_context4.next = 8;
|
|
276
|
-
return fetchFilesPaths(client, doctype, [document]);
|
|
277
|
-
|
|
278
|
-
case 8:
|
|
279
|
-
_context4.t4 = _context4.sent;
|
|
280
|
-
|
|
281
|
-
case 9:
|
|
282
|
-
_context4.t5 = _context4.t4;
|
|
283
|
-
_context4.t6 = (0, _context4.t1)(_context4.t2, _context4.t3, _context4.t5);
|
|
284
|
-
|
|
285
|
-
_context4.t0.dispatch.call(_context4.t0, _context4.t6);
|
|
286
|
-
|
|
287
|
-
case 12:
|
|
288
|
-
case "end":
|
|
289
|
-
return _context4.stop();
|
|
242
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
243
|
+
case 0:
|
|
244
|
+
_this$props3 = _this.props, client = _this$props3.client, doctype = _this$props3.doctype;
|
|
245
|
+
recipients = _getRecipients(_this.state, document.id);
|
|
246
|
+
sharing = getDocumentSharing(_this.state, document.id);
|
|
247
|
+
_context5.next = 5;
|
|
248
|
+
return _this.sharingCol.revokeAllRecipients(sharing);
|
|
249
|
+
|
|
250
|
+
case 5:
|
|
251
|
+
recipients.map( /*#__PURE__*/function () {
|
|
252
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(recipient, recipientIndex) {
|
|
253
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
254
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
255
|
+
case 0:
|
|
256
|
+
_context4.t0 = _this;
|
|
257
|
+
_context4.t1 = revokeRecipient;
|
|
258
|
+
_context4.t2 = sharing;
|
|
259
|
+
_context4.t3 = recipientIndex;
|
|
260
|
+
_context4.t4 = document.path;
|
|
261
|
+
|
|
262
|
+
if (_context4.t4) {
|
|
263
|
+
_context4.next = 9;
|
|
264
|
+
break;
|
|
290
265
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
266
|
+
|
|
267
|
+
_context4.next = 8;
|
|
268
|
+
return fetchFilesPaths(client, doctype, [document]);
|
|
269
|
+
|
|
270
|
+
case 8:
|
|
271
|
+
_context4.t4 = _context4.sent;
|
|
272
|
+
|
|
273
|
+
case 9:
|
|
274
|
+
_context4.t5 = _context4.t4;
|
|
275
|
+
_context4.t6 = (0, _context4.t1)(_context4.t2, _context4.t3, _context4.t5);
|
|
276
|
+
|
|
277
|
+
_context4.t0.dispatch.call(_context4.t0, _context4.t6);
|
|
278
|
+
|
|
279
|
+
case 12:
|
|
280
|
+
case "end":
|
|
281
|
+
return _context4.stop();
|
|
282
|
+
}
|
|
283
|
+
}, _callee4);
|
|
284
|
+
}));
|
|
285
|
+
|
|
286
|
+
return function (_x5, _x6) {
|
|
287
|
+
return _ref7.apply(this, arguments);
|
|
288
|
+
};
|
|
289
|
+
}());
|
|
290
|
+
|
|
291
|
+
case 6:
|
|
292
|
+
case "end":
|
|
293
|
+
return _context5.stop();
|
|
304
294
|
}
|
|
305
295
|
}, _callee5);
|
|
306
296
|
}));
|
|
@@ -315,42 +305,40 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
315
305
|
var _this$props4, client, doctype, sharing;
|
|
316
306
|
|
|
317
307
|
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
318
|
-
while (1) {
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
return _context6.stop();
|
|
353
|
-
}
|
|
308
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
309
|
+
case 0:
|
|
310
|
+
_this$props4 = _this.props, client = _this$props4.client, doctype = _this$props4.doctype;
|
|
311
|
+
sharing = getSharingById(_this.state, sharingId);
|
|
312
|
+
_context6.next = 4;
|
|
313
|
+
return _this.sharingCol.revokeRecipient(sharing, recipientIndex);
|
|
314
|
+
|
|
315
|
+
case 4:
|
|
316
|
+
_context6.t0 = _this;
|
|
317
|
+
_context6.t1 = revokeRecipient;
|
|
318
|
+
_context6.t2 = sharing;
|
|
319
|
+
_context6.t3 = recipientIndex;
|
|
320
|
+
_context6.t4 = document.path;
|
|
321
|
+
|
|
322
|
+
if (_context6.t4) {
|
|
323
|
+
_context6.next = 13;
|
|
324
|
+
break;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
_context6.next = 12;
|
|
328
|
+
return fetchFilesPaths(client, doctype, [document]);
|
|
329
|
+
|
|
330
|
+
case 12:
|
|
331
|
+
_context6.t4 = _context6.sent;
|
|
332
|
+
|
|
333
|
+
case 13:
|
|
334
|
+
_context6.t5 = _context6.t4;
|
|
335
|
+
_context6.t6 = (0, _context6.t1)(_context6.t2, _context6.t3, _context6.t5);
|
|
336
|
+
|
|
337
|
+
_context6.t0.dispatch.call(_context6.t0, _context6.t6);
|
|
338
|
+
|
|
339
|
+
case 16:
|
|
340
|
+
case "end":
|
|
341
|
+
return _context6.stop();
|
|
354
342
|
}
|
|
355
343
|
}, _callee6);
|
|
356
344
|
}));
|
|
@@ -364,20 +352,18 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
364
352
|
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(document) {
|
|
365
353
|
var sharing;
|
|
366
354
|
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
367
|
-
while (1) {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
return _context7.stop();
|
|
380
|
-
}
|
|
355
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
356
|
+
case 0:
|
|
357
|
+
sharing = _getSharingForSelf(_this.state, document.id);
|
|
358
|
+
_context7.next = 3;
|
|
359
|
+
return _this.sharingCol.revokeSelf(sharing);
|
|
360
|
+
|
|
361
|
+
case 3:
|
|
362
|
+
_this.dispatch(revokeSelf(sharing));
|
|
363
|
+
|
|
364
|
+
case 4:
|
|
365
|
+
case "end":
|
|
366
|
+
return _context7.stop();
|
|
381
367
|
}
|
|
382
368
|
}, _callee7);
|
|
383
369
|
}));
|
|
@@ -391,23 +377,21 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
391
377
|
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(document, options) {
|
|
392
378
|
var resp;
|
|
393
379
|
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
394
|
-
while (1) {
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
return _this.permissionCol.createSharingLink(document, options);
|
|
380
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
381
|
+
case 0:
|
|
382
|
+
_context8.next = 2;
|
|
383
|
+
return _this.permissionCol.createSharingLink(document, options);
|
|
399
384
|
|
|
400
|
-
|
|
401
|
-
|
|
385
|
+
case 2:
|
|
386
|
+
resp = _context8.sent;
|
|
402
387
|
|
|
403
|
-
|
|
388
|
+
_this.dispatch(addSharingLink(resp.data));
|
|
404
389
|
|
|
405
|
-
|
|
390
|
+
return _context8.abrupt("return", resp);
|
|
406
391
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
}
|
|
392
|
+
case 5:
|
|
393
|
+
case "end":
|
|
394
|
+
return _context8.stop();
|
|
411
395
|
}
|
|
412
396
|
}, _callee8);
|
|
413
397
|
}));
|
|
@@ -421,53 +405,49 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
421
405
|
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(document, newVerbs) {
|
|
422
406
|
var permissions, responses;
|
|
423
407
|
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
424
|
-
while (1) {
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
var
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
case 5:
|
|
468
|
-
case "end":
|
|
469
|
-
return _context10.stop();
|
|
470
|
-
}
|
|
408
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
409
|
+
case 0:
|
|
410
|
+
permissions = _getDocumentPermissions(_this.state, document.id);
|
|
411
|
+
_context10.next = 3;
|
|
412
|
+
return Promise.all(permissions.map( /*#__PURE__*/function () {
|
|
413
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(permissionDocument) {
|
|
414
|
+
var updatedPermissions, resp;
|
|
415
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
416
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
417
|
+
case 0:
|
|
418
|
+
updatedPermissions = permissionDocument.attributes.permissions;
|
|
419
|
+
Object.keys(updatedPermissions).map(function (permType) {
|
|
420
|
+
updatedPermissions[permType].verbs = newVerbs;
|
|
421
|
+
});
|
|
422
|
+
_context9.next = 4;
|
|
423
|
+
return _this.permissionCol.add(permissionDocument, updatedPermissions);
|
|
424
|
+
|
|
425
|
+
case 4:
|
|
426
|
+
resp = _context9.sent;
|
|
427
|
+
|
|
428
|
+
_this.dispatch(updateSharingLink(resp));
|
|
429
|
+
|
|
430
|
+
return _context9.abrupt("return", resp);
|
|
431
|
+
|
|
432
|
+
case 7:
|
|
433
|
+
case "end":
|
|
434
|
+
return _context9.stop();
|
|
435
|
+
}
|
|
436
|
+
}, _callee9);
|
|
437
|
+
}));
|
|
438
|
+
|
|
439
|
+
return function (_x15) {
|
|
440
|
+
return _ref12.apply(this, arguments);
|
|
441
|
+
};
|
|
442
|
+
}()));
|
|
443
|
+
|
|
444
|
+
case 3:
|
|
445
|
+
responses = _context10.sent;
|
|
446
|
+
return _context10.abrupt("return", responses);
|
|
447
|
+
|
|
448
|
+
case 5:
|
|
449
|
+
case "end":
|
|
450
|
+
return _context10.stop();
|
|
471
451
|
}
|
|
472
452
|
}, _callee10);
|
|
473
453
|
}));
|
|
@@ -481,24 +461,22 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
481
461
|
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(document) {
|
|
482
462
|
var perms;
|
|
483
463
|
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
484
|
-
while (1) {
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
return
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
return _context11.stop();
|
|
501
|
-
}
|
|
464
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
465
|
+
case 0:
|
|
466
|
+
// Because some duplicate links have been created in the past, we must ensure
|
|
467
|
+
// we revoke all of them
|
|
468
|
+
perms = _getDocumentPermissions(_this.state, document.id);
|
|
469
|
+
_context11.next = 3;
|
|
470
|
+
return Promise.all(perms.map(function (p) {
|
|
471
|
+
return _this.permissionCol.destroy(p);
|
|
472
|
+
}));
|
|
473
|
+
|
|
474
|
+
case 3:
|
|
475
|
+
_this.dispatch(revokeSharingLink(perms));
|
|
476
|
+
|
|
477
|
+
case 4:
|
|
478
|
+
case "end":
|
|
479
|
+
return _context11.stop();
|
|
502
480
|
}
|
|
503
481
|
}, _callee11);
|
|
504
482
|
}));
|
|
@@ -604,69 +582,67 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
604
582
|
var _this$props5, doctype, client, _yield$Promise$all, _yield$Promise$all2, sharings, permissions, apps, sharedDocIds, resp, folderPaths, filePaths;
|
|
605
583
|
|
|
606
584
|
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
607
|
-
while (1) {
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
return
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
return _context12.stop();
|
|
669
|
-
}
|
|
585
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
586
|
+
case 0:
|
|
587
|
+
_this$props5 = this.props, doctype = _this$props5.doctype, client = _this$props5.client;
|
|
588
|
+
_context12.next = 3;
|
|
589
|
+
return Promise.all([this.sharingCol.findByDoctype(doctype), this.permissionCol.findLinksByDoctype(doctype), client.query(fetchApps().definition, fetchApps().options)]);
|
|
590
|
+
|
|
591
|
+
case 3:
|
|
592
|
+
_yield$Promise$all = _context12.sent;
|
|
593
|
+
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 3);
|
|
594
|
+
sharings = _yield$Promise$all2[0];
|
|
595
|
+
permissions = _yield$Promise$all2[1];
|
|
596
|
+
apps = _yield$Promise$all2[2];
|
|
597
|
+
this.dispatch(receiveSharings({
|
|
598
|
+
instanceUri: client.options.uri,
|
|
599
|
+
sharings: sharings.data,
|
|
600
|
+
permissions: permissions.data,
|
|
601
|
+
apps: apps.data
|
|
602
|
+
}));
|
|
603
|
+
this.setState({
|
|
604
|
+
hasLoadedAtLeastOnePage: true
|
|
605
|
+
}); // eslint-disable-next-line promise/catch-or-return
|
|
606
|
+
|
|
607
|
+
_context12.next = 12;
|
|
608
|
+
return fetchNextPermissions(permissions, this.dispatch, this.permissionCol);
|
|
609
|
+
|
|
610
|
+
case 12:
|
|
611
|
+
if (!(doctype === 'io.cozy.files')) {
|
|
612
|
+
_context12.next = 22;
|
|
613
|
+
break;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
sharedDocIds = getSharedDocIdsBySharings(sharings);
|
|
617
|
+
_context12.next = 16;
|
|
618
|
+
return client.collection(doctype).all({
|
|
619
|
+
keys: sharedDocIds
|
|
620
|
+
});
|
|
621
|
+
|
|
622
|
+
case 16:
|
|
623
|
+
resp = _context12.sent;
|
|
624
|
+
folderPaths = resp.data.filter(function (f) {
|
|
625
|
+
return f.type === 'directory' && !f.trashed;
|
|
626
|
+
}).map(function (f) {
|
|
627
|
+
return f.path;
|
|
628
|
+
});
|
|
629
|
+
_context12.next = 20;
|
|
630
|
+
return fetchFilesPaths(client, doctype, resp.data.filter(function (f) {
|
|
631
|
+
return f.type !== 'directory' && !f.trashed;
|
|
632
|
+
}));
|
|
633
|
+
|
|
634
|
+
case 20:
|
|
635
|
+
filePaths = _context12.sent;
|
|
636
|
+
this.dispatch(receivePaths([].concat(_toConsumableArray(folderPaths), _toConsumableArray(filePaths))));
|
|
637
|
+
|
|
638
|
+
case 22:
|
|
639
|
+
this.setState({
|
|
640
|
+
allLoaded: true
|
|
641
|
+
});
|
|
642
|
+
|
|
643
|
+
case 23:
|
|
644
|
+
case "end":
|
|
645
|
+
return _context12.stop();
|
|
670
646
|
}
|
|
671
647
|
}, _callee12, this);
|
|
672
648
|
}));
|