Fix parameter passing in contact gift dialogs

- Replace @Emit decorator with direct $emit calls in ContactListItem
- Fix DID comparison from loose to strict equality in nameForDid function
- Resolve issue where giver/recipient names showed as "this unnamed user"

The @Emit decorator was not properly spreading array parameters, causing
the parent component to receive arrays instead of separate string parameters.
This commit is contained in:
Jose Olarte III
2025-07-31 20:13:55 +08:00
parent 433f3c1154
commit f4a7d437c8
2 changed files with 10 additions and 6 deletions

View File

@@ -121,6 +121,12 @@ import { AppString } from "../constants/app";
components: { components: {
EntityIcon, EntityIcon,
}, },
emits: [
"toggle-selection",
"show-identicon",
"show-gifted-dialog",
"open-offer-dialog",
],
}) })
export default class ContactListItem extends Vue { export default class ContactListItem extends Vue {
@Prop({ required: true }) contact!: Contact; @Prop({ required: true }) contact!: Contact;
@@ -151,14 +157,12 @@ export default class ContactListItem extends Vue {
return contact; return contact;
} }
@Emit("show-gifted-dialog")
emitShowGiftedDialog(fromDid: string, toDid: string) { emitShowGiftedDialog(fromDid: string, toDid: string) {
return { fromDid, toDid }; this.$emit("show-gifted-dialog", fromDid, toDid);
} }
@Emit("open-offer-dialog")
emitOpenOfferDialog(did: string, name: string | undefined) { emitOpenOfferDialog(did: string, name: string | undefined) {
return { did, name }; this.$emit("open-offer-dialog", did, name);
} }
/** /**

View File

@@ -191,9 +191,9 @@ export const nameForDid = (
did: string, did: string,
): string => { ): string => {
if (did === activeDid) { if (did === activeDid) {
return "you"; return "You";
} }
const contact = R.find((con) => con.did == did, contacts); const contact = R.find((con) => con.did === did, contacts);
return nameForContact(contact); return nameForContact(contact);
}; };