diff --git a/.vscode/settings.json b/.vscode/settings.json index 6b81ef66c..9e95802ba 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -52,5 +52,13 @@ "source.organizeImports": "always" }, "files.eol": "\n", - "typescript.tsdk": "node_modules/typescript/lib" + "typescript.tsdk": "node_modules/typescript/lib", + "jest.jestCommandLine": "../../node_modules/.bin/jest", + "jest.nodeEnv": { + "USE_LOKIJS": "true" + }, + "jest.virtualFolders": [ + { "name": "Consumption", "rootPath": "packages/consumption" }, + { "name": "Runtime", "rootPath": "packages/runtime" } + ] } diff --git a/packages/consumption/src/modules/requests/itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor.ts b/packages/consumption/src/modules/requests/itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor.ts index 4cf0d227a..de16716f0 100644 --- a/packages/consumption/src/modules/requests/itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor.ts +++ b/packages/consumption/src/modules/requests/itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor.ts @@ -118,6 +118,13 @@ export class ShareAttributeRequestItemProcessor extends GenericRequestItemProces ConsumptionCoreErrors.requests.invalidRequestItem("The provided RelationshipAttribute already exists in the context of the Relationship with the peer.") ); } + if (!requestItem.thirdPartyAddress) { + return ValidationResult.error( + ConsumptionCoreErrors.requests.invalidRequestItem( + "The source attribute provided is a relationship attribute. You must provide a third party address that is the original peer when sharing with a third party." + ) + ); + } } const queryForNonPendingRelationships = { @@ -131,14 +138,6 @@ export class ShareAttributeRequestItemProcessor extends GenericRequestItemProces return ValidationResult.error(ConsumptionCoreErrors.requests.cannotShareRelationshipAttributeOfPendingRelationship()); } - if (recipient && !foundAttribute.shareInfo.peer.equals(recipient) && !requestItem.thirdPartyAddress) { - return ValidationResult.error( - ConsumptionCoreErrors.requests.invalidRequestItem( - "The source attribute provided is a relationship attribute. You must provide a third party address that is the original peer when sharing with a third party." - ) - ); - } - if (requestItem.thirdPartyAddress && !requestItem.thirdPartyAddress.equals(foundAttribute.shareInfo.peer)) { return ValidationResult.error(new CoreError("The third party address must be the peer of the relationship attribute.")); }