Fix offer fulfillment detection + consistencies between ClaimView and ConfirmGiftView #167
Merged
jose
merged 8 commits from claimview-fullfills-offer into master 2 months ago
Loading…
Reference in new issue
There is no content yet.
Delete Branch 'claimview-fullfills-offer'
Deleting a branch is permanent. It CANNOT be undone. Continue?
}const fulfills = this.detailsForGive.fullClaim.fulfills;if (!Array.isArray(fulfills)) {There is one more case here: the fullClaim.fulfills can potentially be a single claim object that is not in an array. (This is the case for most of the schema.org properties: they are defined with a particular type but they could be an array of that type.) So check for
fulfills["@type"]of "Offer" to set otherfulfillsvariables.What's a good way to recreate a claim object that has this particular structure? Gives that fulfill project offers always have
@type: PlanAction,@type: Offerand@type: DonateAction. Gives that fulfill person offers always have@type: Offerand@type: DonateAction.You will have to create one by hand. I'll show how in the issue https://app.clickup.com/t/86b027guj
Thanks, the video was very helpful! I was able to update the code block to test for both array and single-object
fulfills. Now, "This fulfills an offer" shows up for both scenarios.Since the logic is used in two places, I made a utility method for it.
* @param prefix - Optional prefix to add* @returns Formatted string*/capitalizeAndInsertSpacesBeforeCapsWithAPrefix(text: string): string {This is also in ConfirmGiftView, so it's worth pulling out into a "util" file so they can both use the same logic.
In a new commit, I moved that function to
endorserServer.ts, where a similar functioncapitalizeAndInsertSpacesBeforeCaps()already exists, and that both views also use.This looks great!
I just recommended a few small tweaks.
Looks great! 👍
bd072d95ebinto master 2 months agobd072d95eb.