-
Notifications
You must be signed in to change notification settings - Fork 16
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
fix: Hash computation over older item #454
Conversation
Pull Request Test Coverage Report for Build 2017373438
💛 - Coveralls |
src/Item/Item.service.ts
Outdated
|
||
// Compute the content hash of the item to later store it in the DB | ||
attributes.local_content_hash = | ||
attributes?.blockchain_item_id && dbCollection?.contract_address |
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.
two things
- is
attributes?
necessary? seems to always be defined right? - shouldn't this be a function with a name? it's also used elsewhere like in
buildStandardWearableEntityMetadata
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 didn't understand the question about attributes. I'm using attributes there to have an updated representation of what's going to be inserted into the database to compute its hash.
About the second one, it's similar to the one in buildStandardWearableEntityMetadata
, as this one checks that the dbCollection
exists, but I've refactored into a function so we can name it.
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.
The thing about attributes is that we're using ?
to check for a prop, but seems unnecessary given the context.
👍
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.
Oh, you're right! I've changed the code to use the function that checks if the item was published, this code is outdated
This PR moves the computation of the
local_content_hash
of the item down below theupsertDCLItem
method so thelocal_content_hash
gets computed with the changes to the item.Closes #455