Skip to content

Commit

Permalink
Fix/SharedToPeerDVO without sourceAttribute (#134)
Browse files Browse the repository at this point in the history
* fix: make sourceAttribute of shared to peer dvo optional

* chore: version bump

* fix: condition for peer shared Attributes
  • Loading branch information
Milena-Czierlinski authored May 23, 2024
1 parent e7dd113 commit 5fb8980
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/runtime/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nmshd/runtime",
"version": "4.8.0",
"version": "4.8.1",
"description": "The enmeshed client runtime.",
"homepage": "https://enmeshed.eu",
"repository": {
Expand Down
19 changes: 9 additions & 10 deletions packages/runtime/src/dataViews/DataViewExpander.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,7 @@ export class DataViewExpander {
}

// Peer Relationship Attribute
if (relationshipAttribute.owner === localAttribute.shareInfo.peer) {
if (relationshipAttribute.owner.toString() === peer) {
return {
type: "PeerRelationshipAttributeDVO",
id: attribute.id,
Expand Down Expand Up @@ -1082,10 +1082,10 @@ export class DataViewExpander {
}
const identityAttribute = localAttribute.content;

if (localAttribute.shareInfo.sourceAttribute) {
// Own Shared Attribute
if (identityAttribute.owner.toString() === peer) {
// Peer Attribute
return {
type: "SharedToPeerAttributeDVO",
type: "PeerAttributeDVO",
id: attribute.id,
name,
description,
Expand All @@ -1097,22 +1097,20 @@ export class DataViewExpander {
valueHints,
isValid: true,
createdAt: attribute.createdAt,
isOwn: true,
isOwn: false,
peer: peer,
isDraft: false,
requestReference: localAttribute.shareInfo.requestReference?.toString(),
notificationReference: localAttribute.shareInfo.notificationReference?.toString(),
sourceAttribute: localAttribute.shareInfo.sourceAttribute.toString(),
tags: identityAttribute.tags ? identityAttribute.tags : [],
valueType,
deletionStatus: localAttribute.deletionInfo?.deletionStatus,
deletionDate: localAttribute.deletionInfo?.deletionDate.toString()
};
}

// Peer Attribute
// Own Shared Attribute
return {
type: "PeerAttributeDVO",
type: "SharedToPeerAttributeDVO",
id: attribute.id,
name,
description,
Expand All @@ -1124,11 +1122,12 @@ export class DataViewExpander {
valueHints,
isValid: true,
createdAt: attribute.createdAt,
isOwn: false,
isOwn: true,
peer: peer,
isDraft: false,
requestReference: localAttribute.shareInfo.requestReference?.toString(),
notificationReference: localAttribute.shareInfo.notificationReference?.toString(),
sourceAttribute: localAttribute.shareInfo.sourceAttribute?.toString(),
tags: identityAttribute.tags ? identityAttribute.tags : [],
valueType,
deletionStatus: localAttribute.deletionInfo?.deletionStatus,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export interface SharedToPeerAttributeDVO extends LocalAttributeDVO {
peer: string; // Careful: We cannot expand the peer to an IdentityDVO, as the IdentityDVO possibly contains the LocalAttributesDVO of the Relationship (endless recursion)
requestReference?: string;
notificationReference?: string;
sourceAttribute: string;
sourceAttribute?: string;
isOwn: true;
tags: string[];
deletionDate?: string;
Expand Down

0 comments on commit 5fb8980

Please sign in to comment.