passbolt-styleguide 5.14.2 → 5.14.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 (90) hide show
  1. package/RELEASE_NOTES.md +6 -2
  2. package/build/css/help.min.css +2 -2
  3. package/build/css/public.min.css +2 -2
  4. package/build/css/themes/default/api_authentication.min.css +2 -2
  5. package/build/css/themes/default/api_cloud.min.css +2 -2
  6. package/build/css/themes/default/api_main.min.css +2 -2
  7. package/build/css/themes/default/api_reports.min.css +2 -2
  8. package/build/css/themes/default/api_webinstaller.min.css +2 -2
  9. package/build/css/themes/default/ext_app.min.css +3 -3
  10. package/build/css/themes/default/ext_authentication.min.css +2 -2
  11. package/build/css/themes/default/ext_external.min.css +2 -2
  12. package/build/css/themes/default/ext_in_form_cta.min.css +2 -2
  13. package/build/css/themes/default/ext_in_form_menu.min.css +2 -2
  14. package/build/css/themes/default/ext_quickaccess.min.css +2 -2
  15. package/build/css/themes/midgar/api_authentication.min.css +2 -2
  16. package/build/css/themes/midgar/api_main.min.css +2 -2
  17. package/build/css/themes/midgar/api_reports.min.css +2 -2
  18. package/build/css/themes/midgar/ext_app.min.css +3 -3
  19. package/build/css/themes/midgar/ext_authentication.min.css +2 -2
  20. package/build/css/themes/midgar/ext_in_form_cta.min.css +2 -2
  21. package/build/css/themes/midgar/ext_in_form_menu.min.css +2 -2
  22. package/build/css/themes/midgar/ext_quickaccess.min.css +2 -2
  23. package/build/css/themes/solarized_dark/api_authentication.min.css +2 -2
  24. package/build/css/themes/solarized_dark/api_main.min.css +2 -2
  25. package/build/css/themes/solarized_dark/api_reports.min.css +2 -2
  26. package/build/css/themes/solarized_dark/ext_app.min.css +3 -3
  27. package/build/css/themes/solarized_dark/ext_authentication.min.css +2 -2
  28. package/build/css/themes/solarized_dark/ext_in_form_cta.min.css +2 -2
  29. package/build/css/themes/solarized_dark/ext_in_form_menu.min.css +2 -2
  30. package/build/css/themes/solarized_dark/ext_quickaccess.min.css +2 -2
  31. package/build/css/themes/solarized_light/api_authentication.min.css +2 -2
  32. package/build/css/themes/solarized_light/api_main.min.css +2 -2
  33. package/build/css/themes/solarized_light/api_reports.min.css +2 -2
  34. package/build/css/themes/solarized_light/ext_app.min.css +3 -3
  35. package/build/css/themes/solarized_light/ext_authentication.min.css +2 -2
  36. package/build/css/themes/solarized_light/ext_in_form_cta.min.css +2 -2
  37. package/build/css/themes/solarized_light/ext_in_form_menu.min.css +2 -2
  38. package/build/css/themes/solarized_light/ext_quickaccess.min.css +2 -2
  39. package/build/js/dist/api-app.js +1 -1
  40. package/build/locales/cs-CZ/common.json +1 -1
  41. package/build/locales/de-DE/common.json +1 -1
  42. package/build/locales/en-UK/common.json +1 -1
  43. package/build/locales/es-ES/common.json +1 -1
  44. package/build/locales/fr-FR/common.json +1 -1
  45. package/build/locales/it-IT/common.json +1 -1
  46. package/build/locales/ja-JP/common.json +1 -1
  47. package/build/locales/ko-KR/common.json +1 -1
  48. package/build/locales/lt-LT/common.json +1 -1
  49. package/build/locales/nl-NL/common.json +1 -1
  50. package/build/locales/pl-PL/common.json +1 -1
  51. package/build/locales/pt-BR/common.json +1 -1
  52. package/build/locales/ro-RO/common.json +1 -1
  53. package/build/locales/ru-RU/common.json +1 -1
  54. package/build/locales/sl-SI/common.json +1 -1
  55. package/build/locales/sv-SE/common.json +1 -1
  56. package/build/locales/uk-UA/common.json +1 -1
  57. package/package.json +1 -1
  58. package/src/locales/cs-CZ/common.json +1 -1
  59. package/src/locales/de-DE/common.json +1 -1
  60. package/src/locales/en-UK/common.json +1 -1
  61. package/src/locales/es-ES/common.json +1 -1
  62. package/src/locales/fr-FR/common.json +1 -1
  63. package/src/locales/it-IT/common.json +1 -1
  64. package/src/locales/ja-JP/common.json +1 -1
  65. package/src/locales/ko-KR/common.json +1 -1
  66. package/src/locales/lt-LT/common.json +1 -1
  67. package/src/locales/nl-NL/common.json +1 -1
  68. package/src/locales/pl-PL/common.json +1 -1
  69. package/src/locales/pt-BR/common.json +1 -1
  70. package/src/locales/ro-RO/common.json +1 -1
  71. package/src/locales/ru-RU/common.json +1 -1
  72. package/src/locales/sl-SI/common.json +1 -1
  73. package/src/locales/sv-SE/common.json +1 -1
  74. package/src/locales/uk-UA/common.json +1 -1
  75. package/src/react-extension/components/Administration/DisplaySubscriptionKey/DisplaySubscriptionKey.js +6 -11
  76. package/src/react-extension/components/Administration/DisplaySubscriptionKey/DisplaySubscriptionKey.test.js +0 -28
  77. package/src/react-extension/components/Resource/HandlePermissionWorkflow/flows/FolderShareFlow.js +7 -7
  78. package/src/react-extension/components/Resource/HandlePermissionWorkflow/flows/FolderShareFlow.test.js +2 -2
  79. package/src/react-extension/components/Resource/HandlePermissionWorkflow/flows/ResourceCreationFlow.js +5 -6
  80. package/src/react-extension/components/Resource/HandlePermissionWorkflow/flows/ResourceEditFlow.js +13 -3
  81. package/src/react-extension/components/Resource/HandlePermissionWorkflow/flows/ResourceShareFlow.js +4 -5
  82. package/src/react-extension/components/Share/GroupPermissionItem.js +12 -19
  83. package/src/react-extension/components/Share/GroupPermissionItem.test.data.js +0 -1
  84. package/src/react-extension/components/Share/GroupPermissionItem.test.js +6 -14
  85. package/src/react-extension/components/Share/GroupPermissionItem.test.stories.js +0 -4
  86. package/src/react-extension/components/Share/ShareDialog.js +166 -152
  87. package/src/react-extension/components/Share/ShareDialog.test.data.js +185 -0
  88. package/src/react-extension/components/Share/ShareDialog.test.js +94 -501
  89. package/src/react-extension/components/Share/ShareDialog.test.stories.js +0 -3
  90. package/src/react-extension/contexts/ExtAppContext.js +0 -6
@@ -822,7 +822,6 @@
822
822
  "Move": "Flytta",
823
823
  "Multi factor authentication": "Multi-faktor autentisering",
824
824
  "Multi Factor Authentication": "Multi-faktor autentisering",
825
- "Multi resource and folder share is not implemented.": "Multi-resurs och mappdelning är inte implementerat.",
826
825
  "Multi-factor authentication (MFA) is a method of confirming a user's identity that requires presenting two or more pieces of evidence (or factor).": "Multi-faktor autentisering (MFA) är en metod för att bekräfta en användares identitet som kräver att två eller fler bevis(eller faktorer) presenteras.",
827
826
  "Multi-factor authentication has been disabled successfully": "Multi-faktor autentisering har inaktiverats framgångsrikt",
828
827
  "My Profile": "Min profil",
@@ -1011,6 +1010,7 @@
1011
1010
  "Please install the browser extension.": "Vänligen installera tillägget till webbläsaren.",
1012
1011
  "Please make sure there is at least one group manager.": "Vänligen se till att det finns minst en gruppchef.",
1013
1012
  "Please make sure there is at least one owner.": "Vänligen se till att det finns minst en ägare.",
1013
+ "Please make sure you are still owner.": "Kontrollera att du fortfarande är ägare.",
1014
1014
  "Please review carefully this configuration as it will not be trivial to change this later.": "Granska konfigurationen noggrant eftersom den inte blir enkel att ändra senare.",
1015
1015
  "Please review carefully this configuration.": "Granska konfigurationen noggrant.",
1016
1016
  "Please save the settings to disable the feature.": "Spara inställningarna för att inaktivera funktionen.",
@@ -822,7 +822,6 @@
822
822
  "Move": "Перемістити",
823
823
  "Multi factor authentication": "Багатофакторна автентифікація",
824
824
  "Multi Factor Authentication": "Багатофакторна автентифікація",
825
- "Multi resource and folder share is not implemented.": "Спільне використання декількох ресурсів та тек не реалізовано.",
826
825
  "Multi-factor authentication (MFA) is a method of confirming a user's identity that requires presenting two or more pieces of evidence (or factor).": "Багатофакторна автентифікація (MFA) — це метод підтвердження особи користувача, який потребує два або більше факторів аутентифікації.",
827
826
  "Multi-factor authentication has been disabled successfully": "Багатофакторна автентифікація була успішно вимкнена",
828
827
  "My Profile": "Мій профіль",
@@ -1011,6 +1010,7 @@
1011
1010
  "Please install the browser extension.": "Будь ласка, встановіть розширення для браузера.",
1012
1011
  "Please make sure there is at least one group manager.": "Будь ласка, переконайтеся, що є принаймні один менеджер групи.",
1013
1012
  "Please make sure there is at least one owner.": "Будь ласка, переконайтеся, що є принаймні один власник.",
1013
+ "Please make sure you are still owner.": "Будь ласка, переконайтеся, що ви все ще є власником.",
1014
1014
  "Please review carefully this configuration as it will not be trivial to change this later.": "Будь ласка, ретельно перевірте цю конфігурацію, оскільки пізніше її не буде просто змінити.",
1015
1015
  "Please review carefully this configuration.": "Будь ласка, ретельно перевірте цю конфігурацію.",
1016
1016
  "Please save the settings to disable the feature.": "Будь ласка, збережіть налаштування, щоб вимкнути функцію.",
@@ -102,16 +102,11 @@ class DisplaySubscriptionKey extends React.Component {
102
102
  * Open the EditSubscriptionKey dialog to upload a new subscription key (CE to PRO upgrade).
103
103
  */
104
104
  handleAddSubscriptionKey() {
105
- if (this.hasEditionPlugin()) {
106
- this.props.dialogContext.open(EditSubscriptionKey, {
107
- title: this.props.t("New subscription key"),
108
- onSave: this.handleSaveSubscriptionKey,
109
- warning: this.translate("You and your team will be disconnected at the end of the process."),
110
- });
111
- } else {
112
- // Backward compatibility with API < v5.13.0
113
- this.handleUpdateKey();
114
- }
105
+ this.props.dialogContext.open(EditSubscriptionKey, {
106
+ title: this.props.t("New subscription key"),
107
+ onSave: this.handleSaveSubscriptionKey,
108
+ warning: this.translate("You and your team will be disconnected at the end of the process."),
109
+ });
115
110
  }
116
111
 
117
112
  /**
@@ -382,7 +377,7 @@ class DisplaySubscriptionKey extends React.Component {
382
377
  </button>
383
378
  </>
384
379
  )}
385
- {this.props.context.siteSettings.isCommunityEdition && (
380
+ {this.props.context.siteSettings.isCommunityEdition && this.hasEditionPlugin() && (
386
381
  <>
387
382
  <button className="button primary form" type="button" onClick={this.handleAddSubscriptionKey}>
388
383
  <Trans>Upload subscription key</Trans>
@@ -378,34 +378,6 @@ describe("DisplaySubscriptionKeyPage", () => {
378
378
  expect(page.downgradeToCommunityButton).toBeNull();
379
379
  });
380
380
 
381
- it("As CE AD the Upload subscription key button should be rendered", async () => {
382
- expect.assertions(2);
383
-
384
- const noPluginProps = propsWithoutEditionPlugin();
385
- jest.spyOn(noPluginProps.context.siteSettings, "isCommunityEdition", "get").mockReturnValue(true);
386
- page = new DisplaySubscriptionKeyPage(noPluginProps.context, noPluginProps);
387
- await screen.findByText("Details");
388
-
389
- expect(page.toolbarActionsUpdateButton).not.toBeNull();
390
- expect(page.toolbarActionsUpdateButton.textContent.trim()).toBe("Upload subscription key");
391
- });
392
-
393
- it("As CE AD clicking Upload subscription key should fallback to the legacy update flow", async () => {
394
- expect.assertions(2);
395
-
396
- const noPluginProps = propsWithoutEditionPlugin();
397
- jest.spyOn(noPluginProps.context.siteSettings, "isCommunityEdition", "get").mockReturnValue(true);
398
- page = new DisplaySubscriptionKeyPage(noPluginProps.context, noPluginProps);
399
- await screen.findByText("Details");
400
-
401
- await page.updateKey();
402
-
403
- expect(noPluginProps.dialogContext.open).toHaveBeenCalledWith(EditSubscriptionKey);
404
- expect(noPluginProps.context.setContext).toHaveBeenCalledWith({
405
- editSubscriptionKey: { key: mockSubscription.data },
406
- });
407
- });
408
-
409
381
  it("As AD the Details and Plans sections should still be rendered", async () => {
410
382
  expect.assertions(3);
411
383
 
@@ -97,10 +97,10 @@ export class FolderShareFlow extends AbstractPermissionFlow {
97
97
  */
98
98
  openShareDialog() {
99
99
  this.props.dialogContext.open(ShareDialog, {
100
- initialResources: [
100
+ initialFolders: [
101
101
  {
102
102
  id: this.folderId,
103
- metadata: { name: this.props.folder.metadata?.name ?? this.props.folder.name ?? "" },
103
+ metadata: { name: this.props.folder.name ?? "" },
104
104
  permission: this.props.folder.permission,
105
105
  permissions: this.state.folderSnapshot.permissions,
106
106
  },
@@ -110,6 +110,7 @@ export class FolderShareFlow extends AbstractPermissionFlow {
110
110
  initialUsers: this.state.folderSnapshot.users,
111
111
  onConfirm: this.handleShareDialogConfirm,
112
112
  onClose: this.handleShareDialogClose,
113
+ isPermissionConfirmationMode: false,
113
114
  });
114
115
  this.setState({ status: FOLDER_SHARE_FLOW_STATUS.SHARE_DIALOG_OPEN });
115
116
  }
@@ -120,9 +121,10 @@ export class FolderShareFlow extends AbstractPermissionFlow {
120
121
  * the operator confirmed the existing permissions as-is: nothing is sent. The extension re-derives
121
122
  * the propagation to the folder's content.
122
123
  * @param {Array<object>} folderPermissionChanges The DTO-shape folder permission changes.
124
+ * @param {boolean} canOperatorRead true if the operator can still read the modified folder
123
125
  * @returns {Promise<void>}
124
126
  */
125
- async handleShareDialogConfirm(folderPermissionChanges) {
127
+ async handleShareDialogConfirm(folderPermissionChanges, canOperatorRead) {
126
128
  this.shareConfirmed = true;
127
129
  try {
128
130
  const currentSnapshot = await this.permissionSnapshotService.buildSnapshotForFolderShare(this.folderId);
@@ -136,10 +138,8 @@ export class FolderShareFlow extends AbstractPermissionFlow {
136
138
  if (folderPermissionChanges.length) {
137
139
  await this.permissionServiceWorkerService.saveFoldersPermissions(this.folderId, folderPermissionChanges);
138
140
  }
139
- await this.finalizeSuccess(
140
- this.props.t("The permissions have been changed successfully."),
141
- `/app/folders/view/${this.folderId}`,
142
- );
141
+ const redirectUrl = canOperatorRead ? `/app/folders/view/${this.folderId}` : `/app/passwords/`;
142
+ await this.finalizeSuccess(this.props.t("The permissions have been changed successfully."), redirectUrl);
143
143
  } catch (error) {
144
144
  this.handleError(error);
145
145
  }
@@ -103,8 +103,8 @@ describe("FolderShareFlow", () => {
103
103
  expect(shareProps.acoType).toStrictEqual(PermissionEntity.ACO_FOLDER);
104
104
  // The single dialog sets and validates at once: editable, not read-only.
105
105
  expect(shareProps.readOnly).toBeUndefined();
106
- expect(shareProps.initialResources).toHaveLength(1);
107
- expect(shareProps.initialResources[0].id).toStrictEqual(folderId);
106
+ expect(shareProps.initialFolders).toHaveLength(1);
107
+ expect(shareProps.initialFolders[0].id).toStrictEqual(folderId);
108
108
  });
109
109
 
110
110
  it("As LU confirming the folder permissions should save them (extension propagates to content) without a second dialog", async () => {
@@ -181,9 +181,10 @@ export class ResourceCreationFlow extends AbstractPermissionFlow {
181
181
  * delegate the operator-only create + share orchestration to the extension via a single
182
182
  * `passbolt.resources.create` call carrying both the secret and the permission changes.
183
183
  * @param {Array<object>} permissionChanges The DTO-shape permission changes ShareDialog emits.
184
+ * @param {boolean} canOperatorRead true if the operator can still read the modified resource
184
185
  * @returns {Promise<void>}
185
186
  */
186
- async handleShareDialogConfirm(permissionChanges) {
187
+ async handleShareDialogConfirm(permissionChanges, canOperatorRead) {
187
188
  this.shareConfirmed = true;
188
189
  try {
189
190
  const currentSnapshot = await this.permissionSnapshotService.buildSnapshotForResourceCreation(
@@ -205,10 +206,8 @@ export class ResourceCreationFlow extends AbstractPermissionFlow {
205
206
  null,
206
207
  );
207
208
  const created = await this.createResource(this.pendingResourceFormEntity, finalChanges);
208
- await this.finalizeSuccess(
209
- this.props.t("The resource has been added successfully"),
210
- `/app/passwords/view/${created.id}`,
211
- );
209
+ const redirectUrl = canOperatorRead ? `/app/passwords/view/${created.id}` : `/app/passwords/`;
210
+ await this.finalizeSuccess(this.props.t("The resource has been added successfully"), redirectUrl);
212
211
  this.closeCreateResourceDialog();
213
212
  this.terminate();
214
213
  } catch (error) {
@@ -256,7 +255,7 @@ export class ResourceCreationFlow extends AbstractPermissionFlow {
256
255
  createResource(resourceFormEntity, permissionChanges) {
257
256
  const resourceDto = resourceFormEntity.toResourceDto();
258
257
  const resourceType = resourceFormEntity.resourceTypeId
259
- ? this.props.context.resourceTypesCollection?.getFirstById(resourceFormEntity.resourceTypeId)
258
+ ? resourceFormEntity.resourceTypes?.getFirstById(resourceFormEntity.resourceTypeId)
260
259
  : null;
261
260
  const isV4PasswordString = resourceType?.slug === RESOURCE_TYPE_PASSWORD_STRING_SLUG;
262
261
  const secretDto = isV4PasswordString ? resourceFormEntity.toSecretDto().password : resourceFormEntity.toSecretDto();
@@ -140,6 +140,7 @@ export class ResourceEditFlow extends AbstractPermissionFlow {
140
140
  readOnly: this.isShareReadOnly,
141
141
  onConfirm: this.handleShareDialogConfirm,
142
142
  onClose: this.handleShareDialogClose,
143
+ ensureOperatorIsOwner: !this.isShareReadOnly,
143
144
  });
144
145
  this.setState({ status: RESOURCE_EDIT_FLOW_STATUS.SHARE_DIALOG_OPEN });
145
146
  }
@@ -190,9 +191,10 @@ export class ResourceEditFlow extends AbstractPermissionFlow {
190
191
  * read-only mode the deltas are empty, so the resource is simply re-encrypted for its existing
191
192
  * recipients.
192
193
  * @param {Array<object>} permissionChanges The DTO-shape permission changes ShareDialog emits.
194
+ * @param {boolean} isPersonal true if the resource must be marked as personal
193
195
  * @returns {Promise<void>}
194
196
  */
195
- async handleShareDialogConfirm(permissionChanges) {
197
+ async handleShareDialogConfirm(permissionChanges, _, isPersonal) {
196
198
  this.shareConfirmed = true;
197
199
  try {
198
200
  const currentSnapshot = await this.permissionSnapshotService.buildSnapshotForResourceEdition(
@@ -205,7 +207,12 @@ export class ResourceEditFlow extends AbstractPermissionFlow {
205
207
  ),
206
208
  );
207
209
  }
208
- await this.updateResource(this.pendingResourceFormEntity, this.pendingResourceSecret, permissionChanges);
210
+ await this.updateResource(
211
+ this.pendingResourceFormEntity,
212
+ this.pendingResourceSecret,
213
+ permissionChanges,
214
+ isPersonal,
215
+ );
209
216
  await this.finalizeSuccess(
210
217
  this.props.t("The resource has been updated successfully"),
211
218
  `/app/passwords/view/${this.props.resource.id}`,
@@ -252,11 +259,14 @@ export class ResourceEditFlow extends AbstractPermissionFlow {
252
259
  * `permissionChanges` is non-empty the extension re-encrypts the secret and runs the share
253
260
  * orchestration in the same call (single passphrase prompt, single progress dialog).
254
261
  * @param {ResourceFormEntity} resourceFormEntity
262
+ * @param {Object|null} secretDto the updated secret is any
255
263
  * @param {Array<object>} [permissionChanges] Operator-confirmed permission changes.
264
+ * @param {boolean} [isPersonal=true] must be true when the resource is actually personal
256
265
  * @returns {Promise<Object>} The updated resource DTO.
257
266
  */
258
- updateResource(resourceFormEntity, secretDto, permissionChanges) {
267
+ updateResource(resourceFormEntity, secretDto, permissionChanges, isPersonal = true) {
259
268
  const resourceDto = resourceFormEntity.toResourceDto();
269
+ resourceDto.personal = isPersonal;
260
270
  return this.permissionServiceWorkerService.updateResource(resourceDto, secretDto, permissionChanges);
261
271
  }
262
272
  }
@@ -113,9 +113,10 @@ export class ResourceShareFlow extends AbstractPermissionFlow {
113
113
  * dialog emits deltas already targeting the real resources, so they are saved as-is. An empty
114
114
  * delta set means the operator confirmed the existing permissions as-is: nothing is sent.
115
115
  * @param {Array<object>} permissionChanges The DTO-shape permission changes ShareDialog emits.
116
+ * @param {boolean} canOperatorRead true if the operator can still read the modified resource
116
117
  * @returns {Promise<void>}
117
118
  */
118
- async handleShareDialogConfirm(permissionChanges) {
119
+ async handleShareDialogConfirm(permissionChanges, canOperatorRead) {
119
120
  this.shareConfirmed = true;
120
121
  try {
121
122
  const currentSnapshots = await this.permissionSnapshotService.buildSnapshotForResourcesShare(this.resourcesIds);
@@ -130,10 +131,8 @@ export class ResourceShareFlow extends AbstractPermissionFlow {
130
131
  if (permissionChanges.length) {
131
132
  await this.permissionServiceWorkerService.saveResourcesPermissions(this.resourcesIds, permissionChanges);
132
133
  }
133
- await this.finalizeSuccess(
134
- this.props.t("The permissions have been changed successfully."),
135
- `/app/passwords/view/${this.resourcesIds[0]}`,
136
- );
134
+ const redirectUrl = canOperatorRead ? `/app/passwords/view/${this.resourcesIds[0]}` : `/app/passwords/`;
135
+ await this.finalizeSuccess(this.props.t("The permissions have been changed successfully."), redirectUrl);
137
136
  } catch (error) {
138
137
  this.handleError(error);
139
138
  }
@@ -47,13 +47,10 @@ class GroupPermissionItem extends Component {
47
47
  * @returns {string}
48
48
  */
49
49
  getClassName() {
50
- let className = "row";
50
+ let className = "row has-caret";
51
51
  if (this.props.updated) {
52
52
  className += " permission-updated";
53
53
  }
54
- if (this.props.canDisplayGroupMembers) {
55
- className += " has-caret";
56
- }
57
54
  return className;
58
55
  }
59
56
 
@@ -111,19 +108,17 @@ class GroupPermissionItem extends Component {
111
108
  const isInputDisabled = this.props.disabled;
112
109
  return (
113
110
  <li id={`permission-item-${this.props.id}`} className={this.getClassName()}>
114
- {this.props.canDisplayGroupMembers && (
115
- <button
116
- type="button"
117
- className="link no-border group-visibility-toggle"
118
- onClick={this.handleToggleGroupMemberVisibility}
119
- >
120
- {this.props.shouldDisplayGroupMembers ? (
121
- <CaretDownSVG className="baseline svg-icon" />
122
- ) : (
123
- <CaretRightSVG className="baseline svg-icon" />
124
- )}
125
- </button>
126
- )}
111
+ <button
112
+ type="button"
113
+ className="link no-border group-visibility-toggle"
114
+ onClick={this.handleToggleGroupMemberVisibility}
115
+ >
116
+ {this.props.shouldDisplayGroupMembers ? (
117
+ <CaretDownSVG className="baseline svg-icon" />
118
+ ) : (
119
+ <CaretRightSVG className="baseline svg-icon" />
120
+ )}
121
+ </button>
127
122
  <GroupAvatar group={this.props.group} />
128
123
 
129
124
  <div className="aro">
@@ -169,7 +164,6 @@ class GroupPermissionItem extends Component {
169
164
 
170
165
  GroupPermissionItem.defaultProps = {
171
166
  shouldDisplayGroupMembers: false,
172
- canDisplayGroupMembers: false,
173
167
  };
174
168
 
175
169
  GroupPermissionItem.propTypes = {
@@ -183,7 +177,6 @@ GroupPermissionItem.propTypes = {
183
177
  onDelete: PropTypes.func,
184
178
  onToggleGroupMemberVisibility: PropTypes.func,
185
179
  shouldDisplayGroupMembers: PropTypes.bool,
186
- canDisplayGroupMembers: PropTypes.bool,
187
180
  permissionType: PropTypes.number,
188
181
  isReadOnly: PropTypes.bool,
189
182
  t: PropTypes.func, // The translation function
@@ -28,7 +28,6 @@ export function defaultProps(data = {}) {
28
28
  onUpdate: jest.fn(),
29
29
  onDelete: jest.fn(),
30
30
  onToggleGroupMemberVisibility: jest.fn(),
31
- canDisplayGroupMembers: true,
32
31
  ...data,
33
32
  };
34
33
  }
@@ -36,6 +36,12 @@ describe("GroupPermissionItem", () => {
36
36
  const page = new GroupPermissionItemPage(defaultOwnerProps());
37
37
  expect(page.details).toBe("Group");
38
38
  });
39
+
40
+ it("displays the toggle", () => {
41
+ expect.assertions(1);
42
+ const page = new GroupPermissionItemPage(defaultOwnerProps());
43
+ expect(page.groupVisibilityToggle).not.toBeNull();
44
+ });
39
45
  });
40
46
 
41
47
  describe("Permission types", () => {
@@ -84,20 +90,6 @@ describe("GroupPermissionItem", () => {
84
90
  });
85
91
  });
86
92
 
87
- describe("Group members visibility toggle", () => {
88
- it("displays the toggle when canDisplayGroupMembers is true", () => {
89
- expect.assertions(1);
90
- const page = new GroupPermissionItemPage(defaultOwnerProps({ canDisplayGroupMembers: true }));
91
- expect(page.groupVisibilityToggle).not.toBeNull();
92
- });
93
-
94
- it("hides the toggle when canDisplayGroupMembers is false", () => {
95
- expect.assertions(1);
96
- const page = new GroupPermissionItemPage(defaultOwnerProps({ canDisplayGroupMembers: false }));
97
- expect(page.groupVisibilityToggle).toBeNull();
98
- });
99
- });
100
-
101
93
  describe("States", () => {
102
94
  it("adds the permission-updated CSS class when updated is true", () => {
103
95
  expect.assertions(1);
@@ -50,10 +50,6 @@ export const Opened = {
50
50
  args: defaultOwnerProps({ shouldDisplayGroupMembers: true }),
51
51
  };
52
52
 
53
- export const WithoutMembersToggle = {
54
- args: defaultOwnerProps({ canDisplayGroupMembers: false }),
55
- };
56
-
57
53
  export const Varies = {
58
54
  args: defaultVariesProps(),
59
55
  };