Fix offer fulfillment detection + consistencies between ClaimView and ConfirmGiftView #167
Reference in New Issue
Block a user
Delete Branch "claimview-fullfills-offer"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@@ -704,0 +733,4 @@}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.
@@ -761,0 +815,4 @@* @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! 👍