cozy-sharing 4.5.10 → 4.6.1

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,25 @@
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
+ ## [4.6.1](https://github.com/cozy/cozy-libs/compare/cozy-sharing@4.6.0...cozy-sharing@4.6.1) (2022-11-14)
7
+
8
+ **Note:** Version bump only for package cozy-sharing
9
+
10
+
11
+
12
+
13
+
14
+ # [4.6.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@4.5.10...cozy-sharing@4.6.0) (2022-11-10)
15
+
16
+
17
+ ### Features
18
+
19
+ * Reactivate sharing cozy to cozy for notes ([d54138e](https://github.com/cozy/cozy-libs/commit/d54138e29ed2d966f8b1da4b4b4caae2b17a3264))
20
+
21
+
22
+
23
+
24
+
6
25
  ## 4.5.10 (2022-11-09)
7
26
 
8
27
 
@@ -52,7 +52,9 @@ describe('EditableSharingModal', function () {
52
52
 
53
53
  it('will set to false the shared parent / child if the document has no path', function () {
54
54
  var _setup = setup({
55
- document: {}
55
+ document: {
56
+ attributes: {}
57
+ }
56
58
  }),
57
59
  component = _setup.component;
58
60
 
@@ -66,7 +68,8 @@ describe('EditableSharingModal', function () {
66
68
 
67
69
  var _setup2 = setup({
68
70
  document: {
69
- path: '/a'
71
+ path: '/a',
72
+ attributes: {}
70
73
  }
71
74
  }),
72
75
  component = _setup2.component;
@@ -81,7 +84,9 @@ describe('EditableSharingModal', function () {
81
84
  });
82
85
  it('will set to true the sharedChild if a child is shared and the document path fetched latter', function () {
83
86
  var _setup3 = setup({
84
- document: {}
87
+ document: {
88
+ attributes: {}
89
+ }
85
90
  }),
86
91
  component = _setup3.component;
87
92
 
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
+ import flag from 'cozy-flags';
3
4
  import { contactsResponseType, groupsResponseType } from '../propTypes';
4
5
  import ShareDialogCozyToCozy from './ShareDialogCozyToCozy';
5
6
  import ShareDialogOnlyByLink from './ShareDialogOnlyByLink';
@@ -27,11 +28,12 @@ export var ShareModal = function ShareModal(_ref) {
27
28
  sharing = _ref.sharing,
28
29
  sharingDesc = _ref.sharingDesc,
29
30
  twoStepsConfirmationMethods = _ref.twoStepsConfirmationMethods;
30
- var showShareByEmail = documentType !== 'Notes' && documentType !== 'Albums' && !hasSharedParent && !hasSharedChild;
31
+ var showShareCozyToCozyForNotes = flag('notes.sharing-cozy-to-cozy') !== null && flag('notes.sharing-cozy-to-cozy') && documentType === 'Notes';
32
+ var showShareByEmail = showShareCozyToCozyForNotes && documentType !== 'Albums' && !hasSharedParent && !hasSharedChild;
31
33
  var showShareByLink = documentType !== 'Organizations';
32
34
  var showShareOnlyByLink = hasSharedParent || hasSharedChild;
33
35
  var showWhoHasAccess = documentType !== 'Albums';
34
- return /*#__PURE__*/React.createElement(React.Fragment, null, (documentType === 'Notes' || documentType === 'Albums') && /*#__PURE__*/React.createElement(ShareDialogOnlyByLink, {
36
+ return /*#__PURE__*/React.createElement(React.Fragment, null, (!showShareCozyToCozyForNotes || documentType === 'Albums') && /*#__PURE__*/React.createElement(ShareDialogOnlyByLink, {
35
37
  document: document,
36
38
  documentType: documentType,
37
39
  link: link,
@@ -40,7 +42,7 @@ export var ShareModal = function ShareModal(_ref) {
40
42
  onShareByLink: onShareByLink,
41
43
  onUpdateShareLinkPermissions: onUpdateShareLinkPermissions,
42
44
  permissions: permissions
43
- }), documentType !== 'Notes' && documentType !== 'Albums' && /*#__PURE__*/React.createElement(ShareDialogCozyToCozy, {
45
+ }), showShareCozyToCozyForNotes && documentType !== 'Albums' && /*#__PURE__*/React.createElement(ShareDialogCozyToCozy, {
44
46
  contacts: contacts,
45
47
  createContact: createContact,
46
48
  document: document,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-sharing",
3
- "version": "4.5.10",
3
+ "version": "4.6.1",
4
4
  "description": "Provides sharing login for React applications.",
5
5
  "main": "dist/index.js",
6
6
  "author": "Cozy",
@@ -28,7 +28,7 @@
28
28
  "@cozy/minilog": "^1.0.0",
29
29
  "classnames": "^2.2.6",
30
30
  "copy-text-to-clipboard": "^2.1.1",
31
- "cozy-device-helper": "^2.5.0",
31
+ "cozy-device-helper": "^2.6.0",
32
32
  "cozy-doctypes": "^1.85.4",
33
33
  "lodash": "^4.17.19",
34
34
  "react-autosuggest": "^9.4.3",
@@ -63,5 +63,5 @@
63
63
  "sideEffects": [
64
64
  "*.css"
65
65
  ],
66
- "gitHead": "054f0d1955fa38ad3bd404d6d03c2ffd790d9bc9"
66
+ "gitHead": "bf1c3b7b74f13f770cb978fc0879935575790482"
67
67
  }
@@ -44,7 +44,11 @@ describe('EditableSharingModal', () => {
44
44
  }
45
45
 
46
46
  it('will set to false the shared parent / child if the document has no path', () => {
47
- const { component } = setup({ document: {} })
47
+ const { component } = setup({
48
+ document: {
49
+ attributes: {}
50
+ }
51
+ })
48
52
 
49
53
  const mod = component.find(DumbShareModal)
50
54
  expect(mod.length).toBe(1)
@@ -54,7 +58,12 @@ describe('EditableSharingModal', () => {
54
58
 
55
59
  it('will set to true the sharedChild if a child is shared and document has path from the beginning', () => {
56
60
  useFetchDocumentPath.mockReturnValue(['/a'])
57
- const { component } = setup({ document: { path: '/a' } })
61
+ const { component } = setup({
62
+ document: {
63
+ path: '/a',
64
+ attributes: {}
65
+ }
66
+ })
58
67
 
59
68
  const provider = component.find(SharingProvider)
60
69
  provider.instance().dispatch(receivePaths(['/a/b']))
@@ -68,7 +77,11 @@ describe('EditableSharingModal', () => {
68
77
  })
69
78
 
70
79
  it('will set to true the sharedChild if a child is shared and the document path fetched latter', () => {
71
- const { component } = setup({ document: {} })
80
+ const { component } = setup({
81
+ document: {
82
+ attributes: {}
83
+ }
84
+ })
72
85
  useFetchDocumentPath.mockReturnValue(['/a'])
73
86
 
74
87
  const provider = component.find(SharingProvider)
@@ -1,5 +1,6 @@
1
1
  import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
+ import flag from 'cozy-flags'
3
4
 
4
5
  import { contactsResponseType, groupsResponseType } from '../propTypes'
5
6
 
@@ -29,8 +30,13 @@ export const ShareModal = ({
29
30
  sharingDesc,
30
31
  twoStepsConfirmationMethods
31
32
  }) => {
33
+ const showShareCozyToCozyForNotes =
34
+ flag('notes.sharing-cozy-to-cozy') !== null &&
35
+ flag('notes.sharing-cozy-to-cozy') &&
36
+ documentType === 'Notes'
37
+
32
38
  const showShareByEmail =
33
- documentType !== 'Notes' &&
39
+ showShareCozyToCozyForNotes &&
34
40
  documentType !== 'Albums' &&
35
41
  !hasSharedParent &&
36
42
  !hasSharedChild
@@ -40,7 +46,7 @@ export const ShareModal = ({
40
46
 
41
47
  return (
42
48
  <>
43
- {(documentType === 'Notes' || documentType === 'Albums') && (
49
+ {(!showShareCozyToCozyForNotes || documentType === 'Albums') && (
44
50
  <ShareDialogOnlyByLink
45
51
  document={document}
46
52
  documentType={documentType}
@@ -52,7 +58,7 @@ export const ShareModal = ({
52
58
  permissions={permissions}
53
59
  />
54
60
  )}
55
- {documentType !== 'Notes' && documentType !== 'Albums' && (
61
+ {showShareCozyToCozyForNotes && documentType !== 'Albums' && (
56
62
  <ShareDialogCozyToCozy
57
63
  contacts={contacts}
58
64
  createContact={createContact}