Skip to content

Commit

Permalink
Merge branch 'PB-34290_WP34---Edit-standalone-TOTP-resource-in-v5-for…
Browse files Browse the repository at this point in the history
…mat' into 'develop'

PB-34290 WP3.4 - Edit standalone TOTP resource in v5 format

See merge request passbolt/passbolt-styleguide!1700
  • Loading branch information
cedricalfonsi committed Aug 9, 2024
2 parents 8a50e22 + 4b3db91 commit 15dce42
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class EditStandaloneTotp extends Component {
*/
get defaultState() {
const resource = this.props.resource || {};
const name = resource.name || "";
const uri = resource.uri || "";
const name = resource.metadata.name || "";
const uri = resource.metadata.uris?.[0] || "";

return {
nameOriginal: name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ export class HandleTotpWorkflow extends React.Component {
resourceDto.resource_type_id = this.props.context.resourceTypesSettings.findResourceTypeIdBySlug(
this.props.context.resourceTypesSettings.DEFAULT_RESOURCE_TYPES_SLUGS.TOTP
);
// @TODO E2EE resource_type_id duplicate for resource
resourceDto.metadata.resource_type_id = resourceDto.resource_type_id;

return this.props.context.port.request("passbolt.resources.update", resourceDto, secretDto);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ describe("HandleReviewAccountRecoveryRequestWorkflow", () => {
resource_type_id: props.context.resourceTypesSettings.findResourceTypeIdBySlug("totp"),
...totp.toResourceDto()
};
resourceDto.metadata.resource_type_id = props.context.resourceTypesSettings.findResourceTypeIdBySlug("totp");

expect(props.context.port.request).toHaveBeenCalledWith("passbolt.resources.update", resourceDto, totp.toSecretDto());
expect(props.actionFeedbackContext.displaySuccess).toHaveBeenCalledWith("The TOTP has been updated successfully");
Expand All @@ -230,6 +231,7 @@ describe("HandleReviewAccountRecoveryRequestWorkflow", () => {
resource_type_id: props.context.resourceTypesSettings.findResourceTypeIdBySlug("totp"),
...totp.toResourceDto()
};
resourceDto.metadata.resource_type_id = props.context.resourceTypesSettings.findResourceTypeIdBySlug("totp");

expect(props.context.port.request).toHaveBeenCalledWith("passbolt.resources.update", resourceDto, totp.toSecretDto());
expect(props.dialogContext.open).toHaveBeenCalledWith(NotifyError, {error});
Expand Down

0 comments on commit 15dce42

Please sign in to comment.