cozy-sharing 9.0.1 → 9.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,17 @@
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
+ ## [9.0.2](https://github.com/cozy/cozy-libs/compare/cozy-sharing@9.0.1...cozy-sharing@9.0.2) (2023-09-11)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * BuildSharingLink works also for perm from mes papiers ([64980a8](https://github.com/cozy/cozy-libs/commit/64980a81c769168c927fd0348a320db60a48d1bb))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [9.0.1](https://github.com/cozy/cozy-libs/compare/cozy-sharing@9.0.0...cozy-sharing@9.0.1) (2023-09-06)
7
18
 
8
19
 
package/dist/state.js CHANGED
@@ -408,8 +408,15 @@ export var getSharingLink = function getSharingLink(state, docId, documentType)
408
408
  // This shouldn't have happened, but unfortunately some duplicate sharing links have been created in the past
409
409
  var perms = getDocumentPermissions(state, docId);
410
410
  if (perms.length === 0) return null;
411
- var perm = perms[0];
412
- var code = get(perm, 'attributes.shortcodes.email') || get(perm, 'attributes.codes.email');
411
+ var perm = perms[0]; // We used to use `email` as `codes` attribute for a sharingByLink.
412
+ // But when we use cozy-client to create a Permission, by default
413
+ // the codes attribute is set to `code`. MesPapiers app is using this
414
+ // default behavior... So the sharing by link created by mes papiers
415
+ // didn't appear correctly in cozy-sharing.
416
+ // This is a bit ugly, we should have a better way to know if this is
417
+ // a sharing by link or not.
418
+
419
+ var code = get(perm, 'attributes.shortcodes.email') || get(perm, 'attributes.shortcodes.code') || get(perm, 'attributes.codes.email') || get(perm, 'attributes.codes.code');
413
420
 
414
421
  if (code) {
415
422
  return buildSharingLink(state, documentType, code);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-sharing",
3
- "version": "9.0.1",
3
+ "version": "9.0.2",
4
4
  "description": "Provides sharing login for React applications.",
5
5
  "main": "dist/index.js",
6
6
  "author": "Cozy",
@@ -61,5 +61,5 @@
61
61
  "sideEffects": [
62
62
  "*.css"
63
63
  ],
64
- "gitHead": "c867582697ab9df1de763b142cb969d9f1505127"
64
+ "gitHead": "2476315ef7d75a1b63d34637fefbe93db710c3e9"
65
65
  }
package/src/state.js CHANGED
@@ -304,9 +304,18 @@ export const getSharingLink = (state, docId, documentType) => {
304
304
  const perms = getDocumentPermissions(state, docId)
305
305
  if (perms.length === 0) return null
306
306
  const perm = perms[0]
307
+ // We used to use `email` as `codes` attribute for a sharingByLink.
308
+ // But when we use cozy-client to create a Permission, by default
309
+ // the codes attribute is set to `code`. MesPapiers app is using this
310
+ // default behavior... So the sharing by link created by mes papiers
311
+ // didn't appear correctly in cozy-sharing.
312
+ // This is a bit ugly, we should have a better way to know if this is
313
+ // a sharing by link or not.
307
314
  const code =
308
315
  get(perm, 'attributes.shortcodes.email') ||
309
- get(perm, 'attributes.codes.email')
316
+ get(perm, 'attributes.shortcodes.code') ||
317
+ get(perm, 'attributes.codes.email') ||
318
+ get(perm, 'attributes.codes.code')
310
319
  if (code) {
311
320
  return buildSharingLink(state, documentType, code)
312
321
  } else {