Skip to content

Commit be61158

Browse files
committed
changes
1 parent 7c29b24 commit be61158

File tree

8 files changed

+159
-4
lines changed

8 files changed

+159
-4
lines changed

backend/api/submissions/tests/test_submissions.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,34 @@ def test_returns_submissions_paginated(graphql_client, user):
105105
)
106106

107107

108+
def test_accepted_submissions_are_public(graphql_client):
109+
submission = SubmissionFactory(id=1, status=Submission.STATUS.accepted)
110+
SubmissionFactory(
111+
id=2, conference=submission.conference, status=Submission.STATUS.proposed
112+
)
113+
114+
query = """query Submissions($code: String!, $page: Int) {
115+
submissions(code: $code, page: $page, pageSize: 5, onlyAccepted: true) {
116+
pageInfo {
117+
totalPages
118+
totalItems
119+
}
120+
items {
121+
id
122+
}
123+
}
124+
}"""
125+
resp = graphql_client.query(
126+
query,
127+
variables={"code": submission.conference.code},
128+
)
129+
130+
assert not resp.get("errors")
131+
assert len(resp["data"]["submissions"]["items"]) == 1
132+
assert resp["data"]["submissions"]["items"][0]["id"] == submission.hashid
133+
assert resp["data"]["submissions"]["pageInfo"] == {"totalPages": 1, "totalItems": 1}
134+
135+
108136
def test_canceled_submissions_are_excluded(graphql_client, user, mock_has_ticket):
109137
graphql_client.force_login(user)
110138

backend/api/users/tests/test_participant.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from conferences.tests.factories import ConferenceFactory
22
from participants.tests.factories import ParticipantFactory
3+
from submissions.tests.factories import SubmissionFactory
4+
from submissions.models import Submission
35
import pytest
46

57

@@ -49,6 +51,56 @@ def test_user_participant(user, graphql_client):
4951
assert participant_type["previousTalkVideo"] == ""
5052

5153

54+
def test_user_participant_proposals(user, graphql_client):
55+
graphql_client.force_login(user)
56+
participant = ParticipantFactory(
57+
user_id=user.id,
58+
bio="biiiiio",
59+
photo="https://marcopycontest.blob.core.windows.net/participants-avatars/blob.jpg",
60+
website="https://google.it",
61+
twitter_handle="marco",
62+
speaker_level="intermediate",
63+
previous_talk_video="",
64+
)
65+
proposal_1 = SubmissionFactory(
66+
speaker_id=participant.user_id,
67+
conference=participant.conference,
68+
status=Submission.STATUS.accepted,
69+
)
70+
SubmissionFactory(
71+
speaker_id=participant.user_id,
72+
conference=participant.conference,
73+
status=Submission.STATUS.rejected,
74+
)
75+
SubmissionFactory(speaker_id=participant.user_id, status=Submission.STATUS.accepted)
76+
77+
response = graphql_client.query(
78+
"""query($conference: String!) {
79+
me {
80+
participant(conference: $conference) {
81+
id
82+
bio
83+
photo
84+
website
85+
twitterHandle
86+
speakerLevel
87+
previousTalkVideo
88+
proposals {
89+
id
90+
}
91+
}
92+
}
93+
}""",
94+
variables={"conference": participant.conference.code},
95+
)
96+
97+
participant_type = response["data"]["me"]["participant"]
98+
99+
assert participant_type["id"] == participant.hashid
100+
assert len(participant_type["proposals"]) == 1
101+
assert participant_type["proposals"][0]["id"] == proposal_1.hashid
102+
103+
52104
def test_user_participant_when_it_doesnt_exist(user, graphql_client):
53105
graphql_client.force_login(user)
54106
conference_code = ConferenceFactory().code

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ query AcceptedProposals($code: String!, $language: String!) {
55
items {
66
...submissionAccordion
77
id
8+
speaker {
9+
id
10+
fullname
11+
photo
12+
bio
13+
twitterHandle
14+
instagramHandle
15+
linkedinUrl
16+
facebookUrl
17+
mastodonHandle
18+
website
19+
}
820
speaker {
921
id
1022
fullname

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

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import {
2+
CardPart,
23
Grid,
4+
Heading,
35
Link,
6+
MultiplePartsCard,
47
Section,
5-
SpeakerCard,
8+
Text,
69
} from "@python-italia/pycon-styleguide";
710

811
import { useCurrentLanguage } from "~/locale/context";
@@ -40,9 +43,9 @@ export const SpeakersContent = () => {
4043
return (
4144
<Link noHover href={`/profile/${speakerId}`} key={speakerId}>
4245
<SpeakerCard
43-
talkTitle={title}
4446
speakerName={submissions[0].speaker.fullname}
4547
portraitUrl={submissions[0].speaker.photo}
48+
sessions={title}
4649
/>
4750
</Link>
4851
);
@@ -52,3 +55,24 @@ export const SpeakersContent = () => {
5255
</Section>
5356
);
5457
};
58+
59+
const SpeakerCard = ({ portraitUrl, speakerName, sessions }) => (
60+
<MultiplePartsCard>
61+
<CardPart shrink={false} size="none">
62+
<img
63+
style={{
64+
objectFit: "cover",
65+
}}
66+
className="w-full aspect-[1/0.74]"
67+
src={portraitUrl}
68+
alt="speaker portrait"
69+
/>
70+
</CardPart>
71+
<CardPart fullHeight contentAlign="left">
72+
<Heading size={4}>{speakerName}</Heading>
73+
</CardPart>
74+
<CardPart shrink={false} background="milk" contentAlign="left">
75+
<Text size={3}>{sessions}</Text>
76+
</CardPart>
77+
</MultiplePartsCard>
78+
);

frontend/src/components/submission/submission.graphql

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,17 @@ query Submission($id: ID!, $language: String!) {
2828
id
2929
name
3030
}
31+
speaker {
32+
id
33+
fullname
34+
photo
35+
bio
36+
twitterHandle
37+
instagramHandle
38+
linkedinUrl
39+
facebookUrl
40+
mastodonHandle
41+
website
42+
}
3143
}
3244
}

frontend/src/components/voting-card/index.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export const VotingCard = ({
3131
audienceLevel,
3232
duration,
3333
languages,
34+
speaker,
3435
},
3536
}: Props) => {
3637
const [sendVote, { loading, error, data: submissionData }] =
@@ -215,7 +216,21 @@ export const VotingCard = ({
215216
</Text>
216217
</CardPart>
217218
</GridColumn>
218-
<GridColumn colSpan={6}>
219+
{speaker && (
220+
<GridColumn colSpan={2}>
221+
<CardPart contentAlign="left" background="white">
222+
<Text uppercase weight="strong" size="label3">
223+
<FormattedMessage id="voting.speaker" />
224+
</Text>
225+
<Spacer size="small" />
226+
227+
<Text weight="strong" as="p" size={2}>
228+
{speaker.fullname}
229+
</Text>
230+
</CardPart>
231+
</GridColumn>
232+
)}
233+
<GridColumn colSpan={speaker ? 4 : 6}>
219234
<div className="h-full flex items-center justify-end ">
220235
<Link href={`/submission/${id}`}>
221236
<CardPart contentAlign="left" background="white">

frontend/src/locale/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,7 @@ reflects what everyone wants to see!`,
896896
"voting.audienceLevel": "Audience level",
897897
"talk.audienceLevel": "Audience level",
898898
"voting.length": "Length",
899+
"voting.speaker": "Speaker",
899900
"voting.languages": "Languages",
900901
"voting.minutes": "{type} ({duration} minutes)",
901902
"voting.submissionType": "Category",
@@ -1937,6 +1938,8 @@ Affrettati a comprare il biglietto!`,
19371938
"scheduleEventDetail.materials.open": "Apri ({hostname})",
19381939
"scheduleEventDetail.materials.download": "Scarica ({mimeType})",
19391940

1941+
"voting.speaker": "Speaker",
1942+
19401943
"global.sessions": "Sessioni",
19411944

19421945
"scheduleEventDetail.eventTime": "{start} - {end}",

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

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

0 commit comments

Comments
 (0)