cozy-sharing 28.0.1 → 28.0.2
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
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
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
|
+
## [28.0.2](https://github.com/cozy/cozy-libs/compare/cozy-sharing@28.0.1...cozy-sharing@28.0.2) (2025-12-08)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- Use sharing provider to rename shared drive ([6208d72](https://github.com/cozy/cozy-libs/commit/6208d72bf6ebb7330dff82e90fb207754b135671))
|
|
11
|
+
|
|
6
12
|
## [28.0.1](https://github.com/cozy/cozy-libs/compare/cozy-sharing@28.0.0...cozy-sharing@28.0.1) (2025-12-05)
|
|
7
13
|
|
|
8
14
|
### Bug Fixes
|
package/dist/SharingProvider.js
CHANGED
|
@@ -247,176 +247,203 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
247
247
|
};
|
|
248
248
|
}());
|
|
249
249
|
|
|
250
|
+
_defineProperty(_this2, "renameSharedDrive", /*#__PURE__*/function () {
|
|
251
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(document, newName) {
|
|
252
|
+
var sharing;
|
|
253
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
254
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
255
|
+
case 0:
|
|
256
|
+
sharing = getDocumentSharing(_this2.state, document.id);
|
|
257
|
+
_context4.next = 3;
|
|
258
|
+
return _this2.sharingCol.renameSharedDrive(sharing, newName);
|
|
259
|
+
|
|
260
|
+
case 3:
|
|
261
|
+
sharing.description = newName;
|
|
262
|
+
|
|
263
|
+
_this2.dispatch(updateSharing(sharing));
|
|
264
|
+
|
|
265
|
+
case 5:
|
|
266
|
+
case "end":
|
|
267
|
+
return _context4.stop();
|
|
268
|
+
}
|
|
269
|
+
}, _callee4);
|
|
270
|
+
}));
|
|
271
|
+
|
|
272
|
+
return function (_x4, _x5) {
|
|
273
|
+
return _ref6.apply(this, arguments);
|
|
274
|
+
};
|
|
275
|
+
}());
|
|
276
|
+
|
|
250
277
|
_defineProperty(_this2, "revokeAllRecipients", /*#__PURE__*/function () {
|
|
251
|
-
var
|
|
278
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(document) {
|
|
252
279
|
var _this2$props3, client, doctype, recipients, sharing;
|
|
253
280
|
|
|
254
|
-
return _regeneratorRuntime.wrap(function
|
|
255
|
-
while (1) switch (
|
|
281
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
282
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
256
283
|
case 0:
|
|
257
284
|
_this2$props3 = _this2.props, client = _this2$props3.client, doctype = _this2$props3.doctype;
|
|
258
285
|
recipients = _getRecipients(_this2.state, document.id);
|
|
259
286
|
sharing = getDocumentSharing(_this2.state, document.id);
|
|
260
|
-
|
|
287
|
+
_context6.next = 5;
|
|
261
288
|
return _this2.sharingCol.revokeAllRecipients(sharing);
|
|
262
289
|
|
|
263
290
|
case 5:
|
|
264
291
|
recipients.map( /*#__PURE__*/function () {
|
|
265
|
-
var
|
|
266
|
-
return _regeneratorRuntime.wrap(function
|
|
267
|
-
while (1) switch (
|
|
292
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(recipient, recipientIndex) {
|
|
293
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
294
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
268
295
|
case 0:
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
if (
|
|
276
|
-
|
|
296
|
+
_context5.t0 = _this2;
|
|
297
|
+
_context5.t1 = revokeRecipient;
|
|
298
|
+
_context5.t2 = sharing;
|
|
299
|
+
_context5.t3 = recipientIndex;
|
|
300
|
+
_context5.t4 = document.path;
|
|
301
|
+
|
|
302
|
+
if (_context5.t4) {
|
|
303
|
+
_context5.next = 9;
|
|
277
304
|
break;
|
|
278
305
|
}
|
|
279
306
|
|
|
280
|
-
|
|
307
|
+
_context5.next = 8;
|
|
281
308
|
return fetchFilesPaths(client, doctype, [document]);
|
|
282
309
|
|
|
283
310
|
case 8:
|
|
284
|
-
|
|
311
|
+
_context5.t4 = _context5.sent;
|
|
285
312
|
|
|
286
313
|
case 9:
|
|
287
|
-
|
|
288
|
-
|
|
314
|
+
_context5.t5 = _context5.t4;
|
|
315
|
+
_context5.t6 = (0, _context5.t1)(_context5.t2, _context5.t3, _context5.t5);
|
|
289
316
|
|
|
290
|
-
|
|
317
|
+
_context5.t0.dispatch.call(_context5.t0, _context5.t6);
|
|
291
318
|
|
|
292
319
|
case 12:
|
|
293
320
|
case "end":
|
|
294
|
-
return
|
|
321
|
+
return _context5.stop();
|
|
295
322
|
}
|
|
296
|
-
},
|
|
323
|
+
}, _callee5);
|
|
297
324
|
}));
|
|
298
325
|
|
|
299
|
-
return function (
|
|
300
|
-
return
|
|
326
|
+
return function (_x7, _x8) {
|
|
327
|
+
return _ref8.apply(this, arguments);
|
|
301
328
|
};
|
|
302
329
|
}());
|
|
303
330
|
|
|
304
331
|
case 6:
|
|
305
332
|
case "end":
|
|
306
|
-
return
|
|
333
|
+
return _context6.stop();
|
|
307
334
|
}
|
|
308
|
-
},
|
|
335
|
+
}, _callee6);
|
|
309
336
|
}));
|
|
310
337
|
|
|
311
|
-
return function (
|
|
312
|
-
return
|
|
338
|
+
return function (_x6) {
|
|
339
|
+
return _ref7.apply(this, arguments);
|
|
313
340
|
};
|
|
314
341
|
}());
|
|
315
342
|
|
|
316
343
|
_defineProperty(_this2, "revoke", /*#__PURE__*/function () {
|
|
317
|
-
var
|
|
344
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(document, sharingId, recipientIndex) {
|
|
318
345
|
var _this2$props4, client, doctype, sharing;
|
|
319
346
|
|
|
320
|
-
return _regeneratorRuntime.wrap(function
|
|
321
|
-
while (1) switch (
|
|
347
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
348
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
322
349
|
case 0:
|
|
323
350
|
_this2$props4 = _this2.props, client = _this2$props4.client, doctype = _this2$props4.doctype;
|
|
324
351
|
sharing = getSharingById(_this2.state, sharingId);
|
|
325
|
-
|
|
352
|
+
_context7.next = 4;
|
|
326
353
|
return _this2.sharingCol.revokeRecipient(sharing, recipientIndex);
|
|
327
354
|
|
|
328
355
|
case 4:
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
if (
|
|
336
|
-
|
|
356
|
+
_context7.t0 = _this2;
|
|
357
|
+
_context7.t1 = revokeRecipient;
|
|
358
|
+
_context7.t2 = sharing;
|
|
359
|
+
_context7.t3 = recipientIndex;
|
|
360
|
+
_context7.t4 = document.path;
|
|
361
|
+
|
|
362
|
+
if (_context7.t4) {
|
|
363
|
+
_context7.next = 13;
|
|
337
364
|
break;
|
|
338
365
|
}
|
|
339
366
|
|
|
340
|
-
|
|
367
|
+
_context7.next = 12;
|
|
341
368
|
return fetchFilesPaths(client, doctype, [document]);
|
|
342
369
|
|
|
343
370
|
case 12:
|
|
344
|
-
|
|
371
|
+
_context7.t4 = _context7.sent;
|
|
345
372
|
|
|
346
373
|
case 13:
|
|
347
|
-
|
|
348
|
-
|
|
374
|
+
_context7.t5 = _context7.t4;
|
|
375
|
+
_context7.t6 = (0, _context7.t1)(_context7.t2, _context7.t3, _context7.t5);
|
|
349
376
|
|
|
350
|
-
|
|
377
|
+
_context7.t0.dispatch.call(_context7.t0, _context7.t6);
|
|
351
378
|
|
|
352
379
|
case 16:
|
|
353
380
|
case "end":
|
|
354
|
-
return
|
|
381
|
+
return _context7.stop();
|
|
355
382
|
}
|
|
356
|
-
},
|
|
383
|
+
}, _callee7);
|
|
357
384
|
}));
|
|
358
385
|
|
|
359
|
-
return function (
|
|
360
|
-
return
|
|
386
|
+
return function (_x9, _x10, _x11) {
|
|
387
|
+
return _ref9.apply(this, arguments);
|
|
361
388
|
};
|
|
362
389
|
}());
|
|
363
390
|
|
|
364
391
|
_defineProperty(_this2, "revokeGroup", /*#__PURE__*/function () {
|
|
365
|
-
var
|
|
392
|
+
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(document, sharingId, recipientIndex) {
|
|
366
393
|
var _this2$props5, client, doctype, sharing;
|
|
367
394
|
|
|
368
|
-
return _regeneratorRuntime.wrap(function
|
|
369
|
-
while (1) switch (
|
|
395
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
396
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
370
397
|
case 0:
|
|
371
398
|
_this2$props5 = _this2.props, client = _this2$props5.client, doctype = _this2$props5.doctype;
|
|
372
399
|
sharing = getSharingById(_this2.state, sharingId);
|
|
373
|
-
|
|
400
|
+
_context8.next = 4;
|
|
374
401
|
return _this2.sharingCol.revokeGroup(sharing, recipientIndex);
|
|
375
402
|
|
|
376
403
|
case 4:
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
if (
|
|
384
|
-
|
|
404
|
+
_context8.t0 = _this2;
|
|
405
|
+
_context8.t1 = revokeGroupFromState;
|
|
406
|
+
_context8.t2 = sharing;
|
|
407
|
+
_context8.t3 = recipientIndex;
|
|
408
|
+
_context8.t4 = document.path;
|
|
409
|
+
|
|
410
|
+
if (_context8.t4) {
|
|
411
|
+
_context8.next = 13;
|
|
385
412
|
break;
|
|
386
413
|
}
|
|
387
414
|
|
|
388
|
-
|
|
415
|
+
_context8.next = 12;
|
|
389
416
|
return fetchFilesPaths(client, doctype, [document]);
|
|
390
417
|
|
|
391
418
|
case 12:
|
|
392
|
-
|
|
419
|
+
_context8.t4 = _context8.sent;
|
|
393
420
|
|
|
394
421
|
case 13:
|
|
395
|
-
|
|
396
|
-
|
|
422
|
+
_context8.t5 = _context8.t4;
|
|
423
|
+
_context8.t6 = (0, _context8.t1)(_context8.t2, _context8.t3, _context8.t5);
|
|
397
424
|
|
|
398
|
-
|
|
425
|
+
_context8.t0.dispatch.call(_context8.t0, _context8.t6);
|
|
399
426
|
|
|
400
427
|
case 16:
|
|
401
428
|
case "end":
|
|
402
|
-
return
|
|
429
|
+
return _context8.stop();
|
|
403
430
|
}
|
|
404
|
-
},
|
|
431
|
+
}, _callee8);
|
|
405
432
|
}));
|
|
406
433
|
|
|
407
|
-
return function (
|
|
408
|
-
return
|
|
434
|
+
return function (_x12, _x13, _x14) {
|
|
435
|
+
return _ref10.apply(this, arguments);
|
|
409
436
|
};
|
|
410
437
|
}());
|
|
411
438
|
|
|
412
439
|
_defineProperty(_this2, "revokeSelf", /*#__PURE__*/function () {
|
|
413
|
-
var
|
|
440
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(document) {
|
|
414
441
|
var sharing;
|
|
415
|
-
return _regeneratorRuntime.wrap(function
|
|
416
|
-
while (1) switch (
|
|
442
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
443
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
417
444
|
case 0:
|
|
418
445
|
sharing = _getSharingForSelf(_this2.state, document.id);
|
|
419
|
-
|
|
446
|
+
_context9.next = 3;
|
|
420
447
|
return _this2.sharingCol.revokeSelf(sharing);
|
|
421
448
|
|
|
422
449
|
case 3:
|
|
@@ -424,41 +451,41 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
424
451
|
|
|
425
452
|
case 4:
|
|
426
453
|
case "end":
|
|
427
|
-
return
|
|
454
|
+
return _context9.stop();
|
|
428
455
|
}
|
|
429
|
-
},
|
|
456
|
+
}, _callee9);
|
|
430
457
|
}));
|
|
431
458
|
|
|
432
|
-
return function (
|
|
433
|
-
return
|
|
459
|
+
return function (_x15) {
|
|
460
|
+
return _ref11.apply(this, arguments);
|
|
434
461
|
};
|
|
435
462
|
}());
|
|
436
463
|
|
|
437
464
|
_defineProperty(_this2, "shareByLink", /*#__PURE__*/function () {
|
|
438
|
-
var
|
|
465
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(document, options) {
|
|
439
466
|
var resp;
|
|
440
|
-
return _regeneratorRuntime.wrap(function
|
|
441
|
-
while (1) switch (
|
|
467
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
468
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
442
469
|
case 0:
|
|
443
|
-
|
|
470
|
+
_context10.next = 2;
|
|
444
471
|
return _this2.permissionCol.createSharingLink(document, options);
|
|
445
472
|
|
|
446
473
|
case 2:
|
|
447
|
-
resp =
|
|
474
|
+
resp = _context10.sent;
|
|
448
475
|
|
|
449
476
|
_this2.dispatch(addSharingLink(resp.data));
|
|
450
477
|
|
|
451
|
-
return
|
|
478
|
+
return _context10.abrupt("return", resp);
|
|
452
479
|
|
|
453
480
|
case 5:
|
|
454
481
|
case "end":
|
|
455
|
-
return
|
|
482
|
+
return _context10.stop();
|
|
456
483
|
}
|
|
457
|
-
},
|
|
484
|
+
}, _callee10);
|
|
458
485
|
}));
|
|
459
486
|
|
|
460
|
-
return function (
|
|
461
|
-
return
|
|
487
|
+
return function (_x16, _x17) {
|
|
488
|
+
return _ref12.apply(this, arguments);
|
|
462
489
|
};
|
|
463
490
|
}());
|
|
464
491
|
|
|
@@ -474,75 +501,75 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
474
501
|
* @return {Array}
|
|
475
502
|
*/
|
|
476
503
|
_defineProperty(_this2, "updateDocumentPermissions", /*#__PURE__*/function () {
|
|
477
|
-
var
|
|
504
|
+
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(document, options) {
|
|
478
505
|
var verbs, expiresAt, password, permissions, responses;
|
|
479
|
-
return _regeneratorRuntime.wrap(function
|
|
480
|
-
while (1) switch (
|
|
506
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
507
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
481
508
|
case 0:
|
|
482
509
|
verbs = options.verbs, expiresAt = options.expiresAt, password = options.password;
|
|
483
510
|
permissions = _getDocumentPermissions(_this2.state, document.id);
|
|
484
|
-
|
|
511
|
+
_context12.next = 4;
|
|
485
512
|
return Promise.all(permissions.map( /*#__PURE__*/function () {
|
|
486
|
-
var
|
|
513
|
+
var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(permissionDocument) {
|
|
487
514
|
var updatedPermissions, resp;
|
|
488
|
-
return _regeneratorRuntime.wrap(function
|
|
489
|
-
while (1) switch (
|
|
515
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
516
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
490
517
|
case 0:
|
|
491
518
|
updatedPermissions = permissionDocument.attributes.permissions;
|
|
492
519
|
Object.keys(updatedPermissions).map(function (permType) {
|
|
493
520
|
updatedPermissions[permType].verbs = verbs;
|
|
494
521
|
});
|
|
495
|
-
|
|
522
|
+
_context11.next = 4;
|
|
496
523
|
return _this2.permissionCol.add(permissionDocument, updatedPermissions, {
|
|
497
524
|
expiresAt: expiresAt,
|
|
498
525
|
password: password
|
|
499
526
|
});
|
|
500
527
|
|
|
501
528
|
case 4:
|
|
502
|
-
resp =
|
|
529
|
+
resp = _context11.sent;
|
|
503
530
|
|
|
504
531
|
_this2.dispatch(updateSharingLink(resp.data));
|
|
505
532
|
|
|
506
|
-
return
|
|
533
|
+
return _context11.abrupt("return", resp);
|
|
507
534
|
|
|
508
535
|
case 7:
|
|
509
536
|
case "end":
|
|
510
|
-
return
|
|
537
|
+
return _context11.stop();
|
|
511
538
|
}
|
|
512
|
-
},
|
|
539
|
+
}, _callee11);
|
|
513
540
|
}));
|
|
514
541
|
|
|
515
|
-
return function (
|
|
516
|
-
return
|
|
542
|
+
return function (_x20) {
|
|
543
|
+
return _ref14.apply(this, arguments);
|
|
517
544
|
};
|
|
518
545
|
}()));
|
|
519
546
|
|
|
520
547
|
case 4:
|
|
521
|
-
responses =
|
|
522
|
-
return
|
|
548
|
+
responses = _context12.sent;
|
|
549
|
+
return _context12.abrupt("return", responses);
|
|
523
550
|
|
|
524
551
|
case 6:
|
|
525
552
|
case "end":
|
|
526
|
-
return
|
|
553
|
+
return _context12.stop();
|
|
527
554
|
}
|
|
528
|
-
},
|
|
555
|
+
}, _callee12);
|
|
529
556
|
}));
|
|
530
557
|
|
|
531
|
-
return function (
|
|
532
|
-
return
|
|
558
|
+
return function (_x18, _x19) {
|
|
559
|
+
return _ref13.apply(this, arguments);
|
|
533
560
|
};
|
|
534
561
|
}());
|
|
535
562
|
|
|
536
563
|
_defineProperty(_this2, "revokeSharingLink", /*#__PURE__*/function () {
|
|
537
|
-
var
|
|
564
|
+
var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(document) {
|
|
538
565
|
var perms;
|
|
539
|
-
return _regeneratorRuntime.wrap(function
|
|
540
|
-
while (1) switch (
|
|
566
|
+
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
567
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
541
568
|
case 0:
|
|
542
569
|
// Because some duplicate links have been created in the past, we must ensure
|
|
543
570
|
// we revoke all of them
|
|
544
571
|
perms = _getDocumentPermissions(_this2.state, document.id);
|
|
545
|
-
|
|
572
|
+
_context13.next = 3;
|
|
546
573
|
return Promise.all(perms.map(function (p) {
|
|
547
574
|
return _this2.permissionCol.destroy(p);
|
|
548
575
|
}));
|
|
@@ -552,13 +579,13 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
552
579
|
|
|
553
580
|
case 4:
|
|
554
581
|
case "end":
|
|
555
|
-
return
|
|
582
|
+
return _context13.stop();
|
|
556
583
|
}
|
|
557
|
-
},
|
|
584
|
+
}, _callee13);
|
|
558
585
|
}));
|
|
559
586
|
|
|
560
|
-
return function (
|
|
561
|
-
return
|
|
587
|
+
return function (_x21) {
|
|
588
|
+
return _ref15.apply(this, arguments);
|
|
562
589
|
};
|
|
563
590
|
}());
|
|
564
591
|
|
|
@@ -640,7 +667,8 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
640
667
|
allLoaded: false,
|
|
641
668
|
revokeAllRecipients: _this2.revokeAllRecipients,
|
|
642
669
|
refresh: _this2.fetchAllSharings,
|
|
643
|
-
hasWriteAccess: _this2.hasWriteAccess
|
|
670
|
+
hasWriteAccess: _this2.hasWriteAccess,
|
|
671
|
+
renameSharedDrive: _this2.renameSharedDrive
|
|
644
672
|
};
|
|
645
673
|
_this2.isPublic = (_props$isPublic = props.isPublic) !== null && _props$isPublic !== void 0 ? _props$isPublic : false;
|
|
646
674
|
_this2.realtime = null;
|
|
@@ -676,14 +704,14 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
676
704
|
}, {
|
|
677
705
|
key: "fetchAllSharings",
|
|
678
706
|
value: function () {
|
|
679
|
-
var _fetchAllSharings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
707
|
+
var _fetchAllSharings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
|
|
680
708
|
var _this$props, doctype, client, _yield$Promise$all, _yield$Promise$all2, sharings, permissions, apps, sharedDocIds, resp, folderPaths, filePaths;
|
|
681
709
|
|
|
682
|
-
return _regeneratorRuntime.wrap(function
|
|
683
|
-
while (1) switch (
|
|
710
|
+
return _regeneratorRuntime.wrap(function _callee14$(_context14) {
|
|
711
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
684
712
|
case 0:
|
|
685
713
|
if (!this.isPublic) {
|
|
686
|
-
|
|
714
|
+
_context14.next = 4;
|
|
687
715
|
break;
|
|
688
716
|
}
|
|
689
717
|
|
|
@@ -692,17 +720,17 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
692
720
|
this.setState({
|
|
693
721
|
allLoaded: true
|
|
694
722
|
});
|
|
695
|
-
return
|
|
723
|
+
return _context14.abrupt("return");
|
|
696
724
|
|
|
697
725
|
case 4:
|
|
698
726
|
_this$props = this.props, doctype = _this$props.doctype, client = _this$props.client;
|
|
699
|
-
|
|
727
|
+
_context14.next = 7;
|
|
700
728
|
return Promise.all([this.sharingCol.findByDoctype(doctype, {
|
|
701
729
|
withSharedDocs: false
|
|
702
730
|
}), this.permissionCol.findLinksByDoctype(doctype), client.fetchQueryAndGetFromState(fetchApps())]);
|
|
703
731
|
|
|
704
732
|
case 7:
|
|
705
|
-
_yield$Promise$all =
|
|
733
|
+
_yield$Promise$all = _context14.sent;
|
|
706
734
|
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 3);
|
|
707
735
|
sharings = _yield$Promise$all2[0];
|
|
708
736
|
permissions = _yield$Promise$all2[1];
|
|
@@ -717,35 +745,35 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
717
745
|
hasLoadedAtLeastOnePage: true
|
|
718
746
|
}); // eslint-disable-next-line promise/catch-or-return
|
|
719
747
|
|
|
720
|
-
|
|
748
|
+
_context14.next = 16;
|
|
721
749
|
return fetchNextPermissions(permissions, this.dispatch, this.permissionCol);
|
|
722
750
|
|
|
723
751
|
case 16:
|
|
724
752
|
if (!(doctype === 'io.cozy.files')) {
|
|
725
|
-
|
|
753
|
+
_context14.next = 26;
|
|
726
754
|
break;
|
|
727
755
|
}
|
|
728
756
|
|
|
729
757
|
sharedDocIds = getSharedDocIdsBySharings(sharings);
|
|
730
|
-
|
|
758
|
+
_context14.next = 20;
|
|
731
759
|
return client.collection(doctype).all({
|
|
732
760
|
keys: sharedDocIds
|
|
733
761
|
});
|
|
734
762
|
|
|
735
763
|
case 20:
|
|
736
|
-
resp =
|
|
764
|
+
resp = _context14.sent;
|
|
737
765
|
folderPaths = resp.data.filter(function (f) {
|
|
738
766
|
return f.type === 'directory' && !f.trashed;
|
|
739
767
|
}).map(function (f) {
|
|
740
768
|
return f.path;
|
|
741
769
|
});
|
|
742
|
-
|
|
770
|
+
_context14.next = 24;
|
|
743
771
|
return fetchFilesPaths(client, doctype, resp.data.filter(function (f) {
|
|
744
772
|
return f.type !== 'directory' && !f.trashed;
|
|
745
773
|
}));
|
|
746
774
|
|
|
747
775
|
case 24:
|
|
748
|
-
filePaths =
|
|
776
|
+
filePaths = _context14.sent;
|
|
749
777
|
this.dispatch(receivePaths([].concat(_toConsumableArray(folderPaths), _toConsumableArray(filePaths))));
|
|
750
778
|
|
|
751
779
|
case 26:
|
|
@@ -755,9 +783,9 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
755
783
|
|
|
756
784
|
case 27:
|
|
757
785
|
case "end":
|
|
758
|
-
return
|
|
786
|
+
return _context14.stop();
|
|
759
787
|
}
|
|
760
|
-
},
|
|
788
|
+
}, _callee14, this);
|
|
761
789
|
}));
|
|
762
790
|
|
|
763
791
|
function fetchAllSharings() {
|
|
@@ -8,6 +8,7 @@ import { useClient } from 'cozy-client';
|
|
|
8
8
|
import { useAlert } from 'cozy-ui/transpiled/react/providers/Alert';
|
|
9
9
|
import { DumbSharedDriveModal } from './DumbSharedDriveModal';
|
|
10
10
|
import withLocales from '../../hoc/withLocales';
|
|
11
|
+
import { useSharingContext } from '../../hooks/useSharingContext';
|
|
11
12
|
import { Contact } from '../../models';
|
|
12
13
|
export var SharedDriveEditModal = withLocales(function (_ref) {
|
|
13
14
|
var document = _ref.document,
|
|
@@ -24,6 +25,9 @@ export var SharedDriveEditModal = withLocales(function (_ref) {
|
|
|
24
25
|
var _useAlert = useAlert(),
|
|
25
26
|
showAlert = _useAlert.showAlert;
|
|
26
27
|
|
|
28
|
+
var _useSharingContext = useSharingContext(),
|
|
29
|
+
renameSharedDrive = _useSharingContext.renameSharedDrive;
|
|
30
|
+
|
|
27
31
|
var createContact = function createContact(contact) {
|
|
28
32
|
return client.create(Contact.doctype, contact);
|
|
29
33
|
};
|
|
@@ -44,7 +48,7 @@ export var SharedDriveEditModal = withLocales(function (_ref) {
|
|
|
44
48
|
case 0:
|
|
45
49
|
_context.prev = 0;
|
|
46
50
|
_context.next = 3;
|
|
47
|
-
return
|
|
51
|
+
return renameSharedDrive(document, value);
|
|
48
52
|
|
|
49
53
|
case 3:
|
|
50
54
|
showAlert({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-sharing",
|
|
3
|
-
"version": "28.0.
|
|
3
|
+
"version": "28.0.2",
|
|
4
4
|
"description": "Provides sharing login for React applications.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "Cozy",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"sideEffects": [
|
|
84
84
|
"*.css"
|
|
85
85
|
],
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "cc29fb457750a8823c3a79441efd34de2bcfa5b9"
|
|
87
87
|
}
|
package/src/SharingProvider.jsx
CHANGED
|
@@ -89,7 +89,8 @@ export class SharingProvider extends Component {
|
|
|
89
89
|
allLoaded: false,
|
|
90
90
|
revokeAllRecipients: this.revokeAllRecipients,
|
|
91
91
|
refresh: this.fetchAllSharings,
|
|
92
|
-
hasWriteAccess: this.hasWriteAccess
|
|
92
|
+
hasWriteAccess: this.hasWriteAccess,
|
|
93
|
+
renameSharedDrive: this.renameSharedDrive
|
|
93
94
|
}
|
|
94
95
|
this.isPublic = props.isPublic ?? false
|
|
95
96
|
this.realtime = null
|
|
@@ -278,6 +279,13 @@ export class SharingProvider extends Component {
|
|
|
278
279
|
this.dispatch(updateSharing(resp.data))
|
|
279
280
|
}
|
|
280
281
|
|
|
282
|
+
renameSharedDrive = async (document, newName) => {
|
|
283
|
+
const sharing = getDocumentSharing(this.state, document.id)
|
|
284
|
+
await this.sharingCol.renameSharedDrive(sharing, newName)
|
|
285
|
+
sharing.description = newName
|
|
286
|
+
this.dispatch(updateSharing(sharing))
|
|
287
|
+
}
|
|
288
|
+
|
|
281
289
|
revokeAllRecipients = async document => {
|
|
282
290
|
const { client, doctype } = this.props
|
|
283
291
|
const recipients = getRecipients(this.state, document.id)
|
|
@@ -7,6 +7,7 @@ import { useAlert } from 'cozy-ui/transpiled/react/providers/Alert'
|
|
|
7
7
|
|
|
8
8
|
import { DumbSharedDriveModal } from './DumbSharedDriveModal'
|
|
9
9
|
import withLocales from '../../hoc/withLocales'
|
|
10
|
+
import { useSharingContext } from '../../hooks/useSharingContext'
|
|
10
11
|
import { Contact } from '../../models'
|
|
11
12
|
|
|
12
13
|
export const SharedDriveEditModal = withLocales(
|
|
@@ -14,6 +15,7 @@ export const SharedDriveEditModal = withLocales(
|
|
|
14
15
|
const client = useClient()
|
|
15
16
|
const { t } = useI18n()
|
|
16
17
|
const { showAlert } = useAlert()
|
|
18
|
+
const { renameSharedDrive } = useSharingContext()
|
|
17
19
|
|
|
18
20
|
const createContact = contact => client.create(Contact.doctype, contact)
|
|
19
21
|
const [name, setName] = useState(sharing?.description)
|
|
@@ -23,9 +25,7 @@ export const SharedDriveEditModal = withLocales(
|
|
|
23
25
|
}
|
|
24
26
|
const onRename = async value => {
|
|
25
27
|
try {
|
|
26
|
-
await
|
|
27
|
-
.collection('io.cozy.sharings')
|
|
28
|
-
.renameSharedDrive(sharing, value)
|
|
28
|
+
await renameSharedDrive(document, value)
|
|
29
29
|
showAlert({
|
|
30
30
|
message: t('SharedDrive.sharedDriveModal.successNotificationUpdate'),
|
|
31
31
|
severity: 'success'
|