-
Notifications
You must be signed in to change notification settings - Fork 2
Extract ForwardedSharingDetails to own collection #777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: rework-attributes
Are you sure you want to change the base?
Extract ForwardedSharingDetails to own collection #777
Conversation
…-to-own-collection
…-to-own-collection
…-to-own-collection
…-to-own-collection
…-to-own-collection
…-to-own-collection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks overall good to me, so feel free to continue.
I know the naming isn't final yet, just wanted to already mention that now that we also flattened the peerSharingDetails, I think we can simplify forwardedSharingDetails e.g. to only forwardedDetails/forwardingDetails. "forwarded" and "sharing" sounds somewhat doppelt-gemoppelt.
const deletionStatus = await attributesController.getForwardedSharingDetailsNotDeletedByRecipient(latestSharedVersion, requestInfo.peer); | ||
if (deletionStatus) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that here you refactored the use of hasDeletionStatusUnequalDeletedByRecipient
while in other places you kept that method. Should we do it coherently?
await this.updateAttributeUnsafe(attribute); | ||
await this.upsertForwardedSharingDetailsForPeer(attribute, peer, sharingDetails); | ||
|
||
// TODO: this event is strange, why do you want to listen on that? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that maybe we need to do some reloading in the app. If we don't see a reason for this event, I am fine with remving it.
public static readonly setting = new CoreIdHelper("LCLSET"); | ||
|
||
public static readonly attribute = new CoreIdHelper("ATT"); | ||
public static readonly attributeForwardedSharingDetails = new CoreIdHelper("ATTFSD"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we decided to change the naming "forwardedSharingDetails" to "forwardedDetails/forwardingDetails" as @Milena-Czierlinski suggested, we must remember changing "ATTFSD" to "ATTFD" as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch :)
// TODO: get the number of forwards | ||
// TODO: filter for query.numberOfForwards |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this be done in this PR?
); | ||
expect(updatedAttribute.forwardedSharingDetails).toHaveLength(1); | ||
expect(updatedAttribute.forwardedSharingDetails![0].deletionInfo).toBeUndefined(); | ||
expect(updatedAttribute.numberOfForwards).toBe(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This forwardedSharingDetail should be fetched and checked if its deletionInfo is undefined.
"forwardedSharingDetails.deletionInfo"?: string | string[]; | ||
"forwardedSharingDetails.deletionInfo.deletionStatus"?: string | string[]; | ||
"forwardedSharingDetails.deletionInfo.deletionDate"?: string | string[]; | ||
numberOfForwards?: string | string[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not number | number[]
(as the type of numberOfForwards
of the LocalAttributeDTO is number)?
const updatedPredecessorForwardedSharingDetails = await consumptionController.attributes.getForwardedSharingDetailsForAttribute(databaseAttribute); | ||
expect(updatedPredecessorForwardedSharingDetails[0].deletionInfo!.deletionStatus).toStrictEqual(EmittedAttributeDeletionStatus.DeletedByRecipient); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is not about Attribute succession.
The same applies to other variable names in this file.
const updatedPredecessorForwardedSharingDetails = await consumptionController.attributes.getForwardedSharingDetailsForAttribute(databaseAttribute); | |
expect(updatedPredecessorForwardedSharingDetails[0].deletionInfo!.deletionStatus).toStrictEqual(EmittedAttributeDeletionStatus.DeletedByRecipient); | |
const updatedAttributeForwardedSharingDetails = await consumptionController.attributes.getForwardedSharingDetailsForAttribute(databaseAttribute); | |
expect(updatedAttributeForwardedSharingDetails[0].deletionInfo!.deletionStatus).toStrictEqual(EmittedAttributeDeletionStatus.DeletedByRecipient); |
private expandForwardingPeers(localAttribute: OwnIdentityAttribute | OwnRelationshipAttribute | PeerRelationshipAttribute): string[] | undefined { | ||
if (!localAttribute.forwardedSharingDetails || localAttribute.forwardedSharingDetails.length === 0) return; | ||
private expandForwardingPeers(_localAttribute: OwnIdentityAttribute | OwnRelationshipAttribute | PeerRelationshipAttribute): string[] | undefined { | ||
// TODO: enable when finding out how to proceed with this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this be done in this PR?
// this is not persisted, only used when returning attributes via the API | ||
public numberOfForwards?: number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- This is the reason why
numberOfForwards
isn't added to ILocalAttribute and LocalAttributeJSON, right? - Would it be appropriate here to add validation that
numberOfForwards
cannot be negative? - Should
numberOfForwards
be added to thetechnicalProperties
above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Schema.ts needs to be updated.
// this is not persisted, only used when returning attributes via the API | ||
public numberOfForwards?: number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this property must be removed here and add to OwnIdentityAttribute, OwnRelationshipAttribute and PeerRelationshipAttribute instead, as for the other LocalAttribute types this property should never be set. @Milena-Czierlinski What do you think?
@serialize() | ||
public wasViewedAt?: CoreDate; | ||
|
||
// this is not persisted, only used when returning attributes via the API |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// this is not persisted, only used when returning attributes via the API | |
// this is not persisted, only used when returning Attributes via the API |
Readiness checklist
Description