Skip to content
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

Add a hash of published product properties to all top-level products #4264

Closed
mikemurray opened this issue May 22, 2018 · 3 comments
Closed
Assignees
Milestone

Comments

@mikemurray
Copy link
Member

mikemurray commented May 22, 2018

Work

  • As part of publishing a Product to the Catalog, create an object hash of all of the properties that should be considered "changed". This will be most properties, but not system-managed properties like updatedAt.
  • Save that hash onto a new property on Products collection, on the top-level product only. Name can be something like publishedProductHash
  • Ensure that that field is being published to client code when an admin is logged in ("Products" publication)
  • Add a migration that calculates this field for all existing CatalogProducts and saves it onto their related Product document.

The remaining client work will be done in #4281

Testing

  • Create a Product and publish it. When logged in as admin, ensure there is a published product hash property on the related Product in client code.
  • Create Products in the base branch and publish them. Update to this branch and ensure that migrations run. Ensure that all Products have a published product hash property in client code.
@aldeed
Copy link
Contributor

aldeed commented Jun 1, 2018

Whoever does this, note the potentially-related changes in #4073

@spencern spencern modified the milestones: Fletcher, Grays Jun 12, 2018
@aldeed aldeed changed the title Product "has unpublished changes" indicator post revision control era Add a hash of published product properties to all top-level products Jun 14, 2018
@kieckhafer kieckhafer self-assigned this Jun 14, 2018
@kieckhafer
Copy link
Member

How is this going to work to compare hashes? It seems we are saving the hash on the original publication of the product to the catalog, but then seems like we might just be overwriting the hash the next time the product is published.

How are we able to compare and see that the hash has changed? Is that done prior to updating the hash? And if so, where do we save the info that the hash has been changed?

@aldeed
Copy link
Contributor

aldeed commented Jun 15, 2018

@kieckhafer When publishing, you'll hash all the properties we care about for the product and save it on the Product. Then, when an admin is editing that product, client code will dynamically re-hash those same properties and compare to the saved hash. So we only ever need the "last published hash" stored because the "current product hash" is generated as needed from the product doc. (That comparison stuff is all part of #4281, not this issue.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants