Skip to content

Commit 358920a

Browse files
committed
changes
1 parent 31b2b5c commit 358920a

File tree

8 files changed

+40
-44
lines changed

8 files changed

+40
-44
lines changed

backend/api/submissions/types.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,16 @@ class SubmissionSpeaker:
4646
id: strawberry.ID
4747
full_name: str
4848
gender: str
49+
_conference_id: strawberry.Private[str]
50+
51+
@strawberry.field
52+
def participant(self, info: Info) -> Participant | None:
53+
participant = (
54+
ParticipantModel.objects.for_conference(self._conference_id)
55+
.filter(user_id=self.id)
56+
.first()
57+
)
58+
return Participant.from_model(participant) if participant else None
4959

5060

5161
@strawberry.type
@@ -128,16 +138,18 @@ def abstract(self, language: str, info: Info) -> str | None:
128138
return self.abstract.localize(language)
129139

130140
@strawberry.field
131-
def speaker(self, info: Info) -> Participant | None:
141+
def speaker(self, info: Info) -> SubmissionSpeaker | None:
132142
if not CanSeeSubmissionRestrictedFields().has_permission(
133143
self, info, is_speaker_data=True
134144
):
135145
return None
136146

137-
participant = ParticipantModel.objects.filter(
138-
user_id=self.speaker_id, conference_id=self.conference_id
139-
).first()
140-
return Participant.from_model(participant) if participant else None
147+
return SubmissionSpeaker(
148+
id=self.speaker_id,
149+
full_name=self.speaker.full_name,
150+
gender=self.speaker.gender,
151+
_conference_id=self.conference_id,
152+
)
141153

142154
@strawberry.field
143155
def id(self, info) -> strawberry.ID:

backend/custom_admin/src/components/fragments/submission.graphql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ fragment SubmissionFragment on Submission {
1717
}
1818
speaker {
1919
id
20-
fullname
20+
fullName
2121
}
2222
}

backend/custom_admin/src/components/schedule-builder/add-item-modal/proposal-preview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const ProposalPreview = ({ proposal }: Props) => {
2020
info={[
2121
{ label: "Type", value: proposal.type.name },
2222
{ label: "Duration", value: `${proposal.duration.duration} mins` },
23-
{ label: "Speaker", value: proposal.speaker.fullname },
23+
{ label: "Speaker", value: proposal.speaker.fullName },
2424
]}
2525
/>
2626
<AddActions proposal={proposal} />

frontend/src/components/blocks/dynamic-content-display-section/accepted-proposals.graphql

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,11 @@ query AcceptedProposals($code: String!, $language: String!) {
77
id
88
speaker {
99
id
10-
fullname
11-
photo
12-
bio
13-
twitterHandle
14-
instagramHandle
15-
linkedinUrl
16-
facebookUrl
17-
mastodonHandle
18-
website
19-
}
20-
speaker {
21-
id
22-
fullname
23-
photo
10+
fullName
11+
participant {
12+
photo
13+
bio
14+
}
2415
}
2516
}
2617
}

frontend/src/components/blocks/dynamic-content-display-section/speakers-content.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const SpeakersContent = () => {
2626

2727
const submissionsBySpeaker = Object.groupBy(
2828
submissions.toSorted((a, b) =>
29-
a.speaker.fullname.localeCompare(b.speaker.fullname),
29+
a.speaker.fullName.localeCompare(b.speaker.fullName),
3030
),
3131
(submission) => submission.speaker.id,
3232
);
@@ -38,8 +38,8 @@ export const SpeakersContent = () => {
3838
([speakerId, submissions]) => (
3939
<Link noHover href={`/profile/${speakerId}`} key={speakerId}>
4040
<SpeakerCard
41-
speakerName={submissions[0].speaker.fullname}
42-
portraitUrl={submissions[0].speaker.photo}
41+
speakerName={submissions[0].speaker.fullName}
42+
portraitUrl={submissions[0].speaker.participant.photo}
4343
sessions={submissions
4444
.map((submission) => submission.title)
4545
.join(",")}

frontend/src/components/submission/submission.graphql

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,17 @@ query Submission($id: ID!, $language: String!) {
3030
}
3131
speaker {
3232
id
33-
fullname
34-
photo
35-
bio
36-
twitterHandle
37-
instagramHandle
38-
linkedinUrl
39-
facebookUrl
40-
mastodonHandle
41-
website
33+
fullName
34+
participant {
35+
photo
36+
bio
37+
twitterHandle
38+
instagramHandle
39+
linkedinUrl
40+
facebookUrl
41+
mastodonHandle
42+
website
43+
}
4244
}
4345
}
4446
}

frontend/src/pages/schedule/fragments/submission.graphql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fragment SubmissionFragment on Submission {
1414

1515
speaker {
1616
id
17-
fullname
17+
fullName
1818
}
1919

2020
type {

frontend/src/pages/submission/[id]/index.tsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,7 @@ export const SubmissionPage = () => {
7676
audienceLevel={submission?.audienceLevel.name}
7777
startTime={null}
7878
endTime={null}
79-
speakers={
80-
submission?.speaker
81-
? [
82-
{
83-
fullName: submission.speaker.fullname,
84-
participant: submission.speaker,
85-
},
86-
]
87-
: null
88-
}
79+
speakers={submission?.speaker ? [submission.speaker] : null}
8980
bookable={false}
9081
spacesLeft={0}
9182
sidebarExtras={

0 commit comments

Comments
 (0)