Fix entity type matching in ClaimView
- Add recipientEntityTypeOverride prop to GiftedDialog component - Add data-testid and data-recipient-entity-type-override attributes for testing - Update updateEntityTypes() to respect recipientEntityTypeOverride when set - Add watcher for recipientEntityTypeOverride prop changes - Update ClaimView to pass recipient entity type override based on project context - Improve recipient determination logic in ClaimView for person vs project recipients
This commit is contained in:
@@ -206,6 +206,7 @@
|
||||
detailsForOffer?.fulfillsPlanHandleId ||
|
||||
''
|
||||
"
|
||||
:recipient-entity-type-override="projectInfo ? 'project' : 'person'"
|
||||
/>
|
||||
|
||||
<div v-if="libsUtil.isGiveAction(veriClaim)">
|
||||
@@ -1047,19 +1048,39 @@ export default class ClaimView extends Vue {
|
||||
),
|
||||
};
|
||||
|
||||
// Use project info as recipient if available, otherwise use undefined
|
||||
const recipient = this.projectInfo
|
||||
? {
|
||||
did:
|
||||
this.detailsForGive?.fulfillsPlanHandleId ||
|
||||
this.detailsForOffer?.fulfillsPlanHandleId,
|
||||
name: this.projectInfo.name,
|
||||
handleId:
|
||||
this.detailsForGive?.fulfillsPlanHandleId ||
|
||||
this.detailsForOffer?.fulfillsPlanHandleId,
|
||||
image: this.projectInfo.imageUrl,
|
||||
}
|
||||
: undefined;
|
||||
// Determine recipient based on whether it's a project or person
|
||||
let recipient: libsUtil.GiverReceiverInputInfo | undefined;
|
||||
|
||||
if (this.projectInfo) {
|
||||
// Recipient is a project
|
||||
recipient = {
|
||||
did:
|
||||
this.detailsForGive?.fulfillsPlanHandleId ||
|
||||
this.detailsForOffer?.fulfillsPlanHandleId,
|
||||
name: this.projectInfo.name,
|
||||
handleId:
|
||||
this.detailsForGive?.fulfillsPlanHandleId ||
|
||||
this.detailsForOffer?.fulfillsPlanHandleId,
|
||||
image: this.projectInfo.imageUrl,
|
||||
};
|
||||
} else {
|
||||
// Recipient is a person - we need to determine who that person is
|
||||
// For offers, the recipient is typically the person who made the offer
|
||||
const offerClaim = this.veriClaim.claim as OfferClaim;
|
||||
const recipientDid =
|
||||
offerClaim.recipient?.identifier || this.veriClaim.issuer;
|
||||
|
||||
if (recipientDid) {
|
||||
const recipientContact = serverUtil.contactForDid(
|
||||
recipientDid,
|
||||
this.allContacts,
|
||||
);
|
||||
recipient = {
|
||||
did: recipientDid,
|
||||
name: recipientContact?.name || recipientDid,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Extract offer information from the claim
|
||||
const offerClaim = this.veriClaim.claim as OfferClaim;
|
||||
|
||||
Reference in New Issue
Block a user