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.
Files changed (34) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/SharingBanner/hooks/useSharingInfos.js +35 -37
  3. package/dist/SharingBanner/hooks/useSharingInfos.spec.js +40 -44
  4. package/dist/SharingProvider.js +351 -375
  5. package/dist/SharingProvider.spec.js +29 -33
  6. package/dist/components/CozyPassFingerprintDialogContent.spec.js +14 -16
  7. package/dist/components/Recipient/LinkRecipientPermissions.js +25 -27
  8. package/dist/components/Recipient/Recipient.spec.js +39 -43
  9. package/dist/components/Recipient/RecipientPermissions.js +20 -22
  10. package/dist/components/ShareButton.js +0 -2
  11. package/dist/components/ShareByEmail.js +53 -55
  12. package/dist/components/ShareByEmail.spec.js +50 -52
  13. package/dist/components/ShareByLink.js +73 -79
  14. package/dist/components/ShareDialogCozyToCozy.spec.js +238 -264
  15. package/dist/components/ShareDialogTwoStepsConfirmationContainer.js +33 -35
  16. package/dist/components/ShareDialogTwoStepsConfirmationContainer.spec.js +240 -266
  17. package/dist/components/SharedBadge.js +0 -2
  18. package/dist/components/badge.styl +7 -5
  19. package/dist/components/button.styl +11 -12
  20. package/dist/components/useFetchDocumentPath.js +16 -18
  21. package/dist/fetchNextPermissions.js +15 -17
  22. package/dist/getSharedDocument.js +13 -15
  23. package/dist/getSharedDocument.spec.js +10 -12
  24. package/dist/helpers/contacts.js +65 -69
  25. package/dist/helpers/contacts.spec.js +30 -32
  26. package/dist/helpers/files.js +26 -28
  27. package/dist/helpers/files.spec.js +54 -58
  28. package/dist/helpers/sharings.js +56 -60
  29. package/dist/helpers/synchronousJobQueue.js +19 -21
  30. package/dist/helpers/synchronousJobQueue.spec.js +39 -43
  31. package/dist/stylesheet.css +28 -820
  32. package/package.json +2 -2
  33. package/src/components/badge.styl +7 -5
  34. package/src/components/button.styl +11 -12
@@ -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
- switch (_context.prev = _context.next) {
77
- case 0:
78
- _this$props = _this.props, client = _this$props.client, doctype = _this$props.doctype;
79
- internalSharing = getSharingById(_this.state, sharing._id);
80
- newSharing = getSharingObject(internalSharing, sharing);
81
-
82
- if (internalSharing) {
83
- updateSharingInStore(_this.dispatch, newSharing);
84
- } else {
85
- docsId = getSharingDocIds(newSharing);
86
-
87
- _this.synchronousJobQueue.push({
88
- function: createSharingInStore,
89
- arguments: {
90
- client: client,
91
- doctype: doctype,
92
- dispatch: _this.dispatch,
93
- docsId: docsId,
94
- sharing: newSharing
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
- case 4:
100
- case "end":
101
- return _context.stop();
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
- switch (_context2.prev = _context2.next) {
121
- case 0:
122
- document = _ref2.document, recipients = _ref2.recipients, readOnlyRecipients = _ref2.readOnlyRecipients, description = _ref2.description, openSharing = _ref2.openSharing;
123
- _this$props2 = _this.props, client = _this$props2.client, doctype = _this$props2.doctype;
124
- sharing = getDocumentSharing(_this.state, document.id);
125
-
126
- if (!sharing) {
127
- _context2.next = 10;
128
- break;
129
- }
130
-
131
- _context2.next = 6;
132
- return _this.addRecipients({
133
- document: sharing,
134
- recipients: recipients,
135
- readOnlyRecipients: readOnlyRecipients
136
- });
137
-
138
- case 6:
139
- sharingResult = _context2.sent;
140
- _context2.next = 9;
141
- return _this.state.onShared({
142
- document: document,
143
- recipients: recipients,
144
- readOnlyRecipients: readOnlyRecipients
145
- });
146
-
147
- case 9:
148
- return _context2.abrupt("return", sharingResult);
149
-
150
- case 10:
151
- previewPath = (_this$props$previewPa = _this.props.previewPath) !== null && _this$props$previewPa !== void 0 ? _this$props$previewPa : '/preview';
152
- _context2.next = 13;
153
- return _this.sharingCol.create({
154
- document: document,
155
- recipients: recipients,
156
- readOnlyRecipients: readOnlyRecipients,
157
- description: description,
158
- previewPath: previewPath,
159
- openSharing: openSharing
160
- });
161
-
162
- case 13:
163
- _yield$_this$sharingC = _context2.sent;
164
- data = _yield$_this$sharingC.data;
165
- _context2.t0 = _this;
166
- _context2.t1 = addSharing;
167
- _context2.t2 = data;
168
- _context2.t3 = document.path;
169
-
170
- if (_context2.t3) {
171
- _context2.next = 23;
172
- break;
173
- }
174
-
175
- _context2.next = 22;
176
- return fetchFilesPaths(client, doctype, [document]);
177
-
178
- case 22:
179
- _context2.t3 = _context2.sent;
180
-
181
- case 23:
182
- _context2.t4 = _context2.t3;
183
- _context2.t5 = (0, _context2.t1)(_context2.t2, _context2.t4);
184
-
185
- _context2.t0.dispatch.call(_context2.t0, _context2.t5);
186
-
187
- _context2.next = 28;
188
- return _this.state.onShared({
189
- document: document,
190
- recipients: recipients,
191
- readOnlyRecipients: readOnlyRecipients
192
- });
193
-
194
- case 28:
195
- return _context2.abrupt("return", data);
196
-
197
- case 29:
198
- case "end":
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
- switch (_context3.prev = _context3.next) {
216
- case 0:
217
- document = _ref4.document, recipients = _ref4.recipients, readOnlyRecipients = _ref4.readOnlyRecipients;
218
- _context3.next = 3;
219
- return _this.sharingCol.addRecipients({
220
- document: document,
221
- recipients: recipients,
222
- readOnlyRecipients: readOnlyRecipients
223
- });
224
-
225
- case 3:
226
- resp = _context3.sent;
227
-
228
- _this.dispatch(updateSharing(resp.data));
229
-
230
- case 5:
231
- case "end":
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
- switch (_context5.prev = _context5.next) {
250
- case 0:
251
- _this$props3 = _this.props, client = _this$props3.client, doctype = _this$props3.doctype;
252
- recipients = _getRecipients(_this.state, document.id);
253
- sharing = getDocumentSharing(_this.state, document.id);
254
- _context5.next = 5;
255
- return _this.sharingCol.revokeAllRecipients(sharing);
256
-
257
- case 5:
258
- recipients.map( /*#__PURE__*/function () {
259
- var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(recipient, recipientIndex) {
260
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
261
- while (1) {
262
- switch (_context4.prev = _context4.next) {
263
- case 0:
264
- _context4.t0 = _this;
265
- _context4.t1 = revokeRecipient;
266
- _context4.t2 = sharing;
267
- _context4.t3 = recipientIndex;
268
- _context4.t4 = document.path;
269
-
270
- if (_context4.t4) {
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
- }, _callee4);
293
- }));
294
-
295
- return function (_x5, _x6) {
296
- return _ref7.apply(this, arguments);
297
- };
298
- }());
299
-
300
- case 6:
301
- case "end":
302
- return _context5.stop();
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
- switch (_context6.prev = _context6.next) {
320
- case 0:
321
- _this$props4 = _this.props, client = _this$props4.client, doctype = _this$props4.doctype;
322
- sharing = getSharingById(_this.state, sharingId);
323
- _context6.next = 4;
324
- return _this.sharingCol.revokeRecipient(sharing, recipientIndex);
325
-
326
- case 4:
327
- _context6.t0 = _this;
328
- _context6.t1 = revokeRecipient;
329
- _context6.t2 = sharing;
330
- _context6.t3 = recipientIndex;
331
- _context6.t4 = document.path;
332
-
333
- if (_context6.t4) {
334
- _context6.next = 13;
335
- break;
336
- }
337
-
338
- _context6.next = 12;
339
- return fetchFilesPaths(client, doctype, [document]);
340
-
341
- case 12:
342
- _context6.t4 = _context6.sent;
343
-
344
- case 13:
345
- _context6.t5 = _context6.t4;
346
- _context6.t6 = (0, _context6.t1)(_context6.t2, _context6.t3, _context6.t5);
347
-
348
- _context6.t0.dispatch.call(_context6.t0, _context6.t6);
349
-
350
- case 16:
351
- case "end":
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
- switch (_context7.prev = _context7.next) {
369
- case 0:
370
- sharing = _getSharingForSelf(_this.state, document.id);
371
- _context7.next = 3;
372
- return _this.sharingCol.revokeSelf(sharing);
373
-
374
- case 3:
375
- _this.dispatch(revokeSelf(sharing));
376
-
377
- case 4:
378
- case "end":
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
- switch (_context8.prev = _context8.next) {
396
- case 0:
397
- _context8.next = 2;
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
- case 2:
401
- resp = _context8.sent;
385
+ case 2:
386
+ resp = _context8.sent;
402
387
 
403
- _this.dispatch(addSharingLink(resp.data));
388
+ _this.dispatch(addSharingLink(resp.data));
404
389
 
405
- return _context8.abrupt("return", resp);
390
+ return _context8.abrupt("return", resp);
406
391
 
407
- case 5:
408
- case "end":
409
- return _context8.stop();
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
- switch (_context10.prev = _context10.next) {
426
- case 0:
427
- permissions = _getDocumentPermissions(_this.state, document.id);
428
- _context10.next = 3;
429
- return Promise.all(permissions.map( /*#__PURE__*/function () {
430
- var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(permissionDocument) {
431
- var updatedPermissions, resp;
432
- return _regeneratorRuntime.wrap(function _callee9$(_context9) {
433
- while (1) {
434
- switch (_context9.prev = _context9.next) {
435
- case 0:
436
- updatedPermissions = permissionDocument.attributes.permissions;
437
- Object.keys(updatedPermissions).map(function (permType) {
438
- updatedPermissions[permType].verbs = newVerbs;
439
- });
440
- _context9.next = 4;
441
- return _this.permissionCol.add(permissionDocument, updatedPermissions);
442
-
443
- case 4:
444
- resp = _context9.sent;
445
-
446
- _this.dispatch(updateSharingLink(resp));
447
-
448
- return _context9.abrupt("return", resp);
449
-
450
- case 7:
451
- case "end":
452
- return _context9.stop();
453
- }
454
- }
455
- }, _callee9);
456
- }));
457
-
458
- return function (_x15) {
459
- return _ref12.apply(this, arguments);
460
- };
461
- }()));
462
-
463
- case 3:
464
- responses = _context10.sent;
465
- return _context10.abrupt("return", responses);
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
- switch (_context11.prev = _context11.next) {
486
- case 0:
487
- // Because some duplicate links have been created in the past, we must ensure
488
- // we revoke all of them
489
- perms = _getDocumentPermissions(_this.state, document.id);
490
- _context11.next = 3;
491
- return Promise.all(perms.map(function (p) {
492
- return _this.permissionCol.destroy(p);
493
- }));
494
-
495
- case 3:
496
- _this.dispatch(revokeSharingLink(perms));
497
-
498
- case 4:
499
- case "end":
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
- switch (_context12.prev = _context12.next) {
609
- case 0:
610
- _this$props5 = this.props, doctype = _this$props5.doctype, client = _this$props5.client;
611
- _context12.next = 3;
612
- return Promise.all([this.sharingCol.findByDoctype(doctype), this.permissionCol.findLinksByDoctype(doctype), client.query(fetchApps().definition, fetchApps().options)]);
613
-
614
- case 3:
615
- _yield$Promise$all = _context12.sent;
616
- _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 3);
617
- sharings = _yield$Promise$all2[0];
618
- permissions = _yield$Promise$all2[1];
619
- apps = _yield$Promise$all2[2];
620
- this.dispatch(receiveSharings({
621
- instanceUri: client.options.uri,
622
- sharings: sharings.data,
623
- permissions: permissions.data,
624
- apps: apps.data
625
- }));
626
- this.setState({
627
- hasLoadedAtLeastOnePage: true
628
- }); // eslint-disable-next-line promise/catch-or-return
629
-
630
- _context12.next = 12;
631
- return fetchNextPermissions(permissions, this.dispatch, this.permissionCol);
632
-
633
- case 12:
634
- if (!(doctype === 'io.cozy.files')) {
635
- _context12.next = 22;
636
- break;
637
- }
638
-
639
- sharedDocIds = getSharedDocIdsBySharings(sharings);
640
- _context12.next = 16;
641
- return client.collection(doctype).all({
642
- keys: sharedDocIds
643
- });
644
-
645
- case 16:
646
- resp = _context12.sent;
647
- folderPaths = resp.data.filter(function (f) {
648
- return f.type === 'directory' && !f.trashed;
649
- }).map(function (f) {
650
- return f.path;
651
- });
652
- _context12.next = 20;
653
- return fetchFilesPaths(client, doctype, resp.data.filter(function (f) {
654
- return f.type !== 'directory' && !f.trashed;
655
- }));
656
-
657
- case 20:
658
- filePaths = _context12.sent;
659
- this.dispatch(receivePaths([].concat(_toConsumableArray(folderPaths), _toConsumableArray(filePaths))));
660
-
661
- case 22:
662
- this.setState({
663
- allLoaded: true
664
- });
665
-
666
- case 23:
667
- case "end":
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
  }));