Skip to content

Commit 8be54cc

Browse files
committed
fix: assuming speaker and member gender
1 parent 3093d91 commit 8be54cc

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

frontend/src/components/speakers/SpeakerCommunications.vue

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313

1414
<script setup lang="ts">
1515
import { getSpeakerCommunications } from "@/api/speakers";
16-
import type {
17-
SpeakerWithParticipation,
18-
SpeakerWithContactObject,
19-
} from "@/dto/speakers";
16+
import type { SpeakerWithContactObject } from "@/dto/speakers";
2017
import { useEventStore } from "@/stores/event";
2118
import { usePostSpeakerThreadMutation } from "@/mutations/speakers";
2219
import Communications from "../Communications.vue";
@@ -25,7 +22,7 @@ import { computed } from "vue";
2522
import { useAuthStore } from "@/stores/auth";
2623
2724
const props = defineProps<{
28-
speaker: SpeakerWithParticipation;
25+
speaker: SpeakerWithContactObject;
2926
}>();
3027
3128
const eventStore = useEventStore();
@@ -44,10 +41,8 @@ const templates = computed(() =>
4441
4542
const createSpeakerTemplateVariables = () => {
4643
const endDate = new Date(eventStore.selectedEvent?.end || 0);
47-
const memberGender = authStore.member?.contactObject?.gender ?? "OTHER";
48-
const speakerGender =
49-
(props.speaker as SpeakerWithContactObject)?.contactObject?.gender ??
50-
"OTHER";
44+
const memberGender = authStore.member!.contactObject.gender;
45+
const speakerGender = props.speaker.contactObject.gender;
5146
5247
// Use contactObject which contains the full Contact (including gender)
5348
// Fallback to empty string when gender is unavailable to avoid runtime errors

frontend/src/lib/templates.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Speaker } from "@/dto/speakers";
1+
import type { SpeakerWithContactObject } from "@/dto/speakers";
22
import type { Company } from "../dto/companies";
33
import { ordinalSuffix } from "./utils";
44
import {
@@ -114,7 +114,7 @@ export interface EmailVariableValueMap {
114114
[EmailVariableKey.EventEndYear]: Date;
115115
[EmailVariableKey.SpeakerArticle]: string;
116116
[EmailVariableKey.SpeakerSuffix]: string;
117-
[EmailVariableKey.Speaker]: Speaker;
117+
[EmailVariableKey.Speaker]: SpeakerWithContactObject;
118118
[EmailVariableKey.MemberArticle]: string;
119119
[EmailVariableKey.MemberSuffix]: string;
120120
[EmailVariableKey.Member]: MemberWithContact;
@@ -130,7 +130,7 @@ export interface VariablesInput {
130130
member: MemberWithContact;
131131
}
132132
export interface SpeakerVariablesInput extends VariablesInput {
133-
speaker: Speaker;
133+
speaker: SpeakerWithContactObject;
134134
paragraph?: string; // Optional paragraph for speaker emails
135135
}
136136
const isSpeakerVariablesInput = (
@@ -531,7 +531,9 @@ export const createEmailVariable = {
531531
value,
532532
}),
533533

534-
speaker: (value: Speaker): EmailVariableInput<EmailVariableKey.Speaker> => ({
534+
speaker: (
535+
value: SpeakerWithContactObject,
536+
): EmailVariableInput<EmailVariableKey.Speaker> => ({
535537
key: EmailVariableKey.Speaker,
536538
value,
537539
}),

0 commit comments

Comments
 (0)