Fix offer fulfillment detection + consistencies between ClaimView and ConfirmGiftView #167

Open
jose wants to merge 4 commits from claimview-fullfills-offer into master
jose commented 1 week ago
Owner
  • Modified the logic to look for fulfillsType "Offer" in the full claim details in order to show "fulfills an offer" link more reliably.
  • Matched wordings and spacings in the fulfills links of ClaimView and ConfirmGiftView for consistency.
- Modified the logic to look for fulfillsType "Offer" in the full claim details in order to show "fulfills an offer" link more reliably. - Matched wordings and spacings in the fulfills links of ClaimView and ConfirmGiftView for consistency.
jose added 2 commits 1 week ago
a1388539c1 Fix: improve offer fulfillment detection in ClaimView
693173f09d UI: wording and spacing consistencies
trentlarson reviewed 4 days ago
}
const fulfills = this.detailsForGive.fullClaim.fulfills;
if (!Array.isArray(fulfills)) {
Poster
Owner

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 other fulfills variables.

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 other `fulfills` variables.
jose commented 3 days ago
Poster
Owner

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: Offer and @type: DonateAction. Gives that fulfill person offers always have @type: Offer and @type: DonateAction.

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: Offer` and `@type: DonateAction`. Gives that fulfill person offers always have `@type: Offer` and `@type: DonateAction`.
trentlarson reviewed 4 days ago
* @param prefix - Optional prefix to add
* @returns Formatted string
*/
capitalizeAndInsertSpacesBeforeCapsWithAPrefix(text: string): string {
Poster
Owner

This is also in ConfirmGiftView, so it's worth pulling out into a "util" file so they can both use the same logic.

This is also in ConfirmGiftView, so it's worth pulling out into a "util" file so they can both use the same logic.
jose commented 3 days ago
Poster
Owner

In a new commit, I moved that function to endorserServer.ts, where a similar function capitalizeAndInsertSpacesBeforeCaps() already exists, and that both views also use.

In a new commit, I moved that function to `endorserServer.ts`, where a similar function `capitalizeAndInsertSpacesBeforeCaps()` already exists, and that both views also use.
trentlarson added 1 commit 4 days ago
Owner

This looks great!

I just recommended a few small tweaks.

This looks great! I just recommended a few small tweaks.
jose added 1 commit 3 days ago
e5ad71505c Chore: move function to serverUtil
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This pull request currently doesn't have any dependencies.

Loading…
There is no content yet.