Skip to content

Commit 98476ea

Browse files
committed
add event location
1 parent 557e4f6 commit 98476ea

File tree

4 files changed

+37
-2
lines changed

4 files changed

+37
-2
lines changed

events/views/create_event.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@ def handle_create_event_view(ack: Callable, body: dict[str, Any], client: WebCli
1616
start_time = (values["start_time"]["start_time"]["selected_date_time"],)
1717
end_time = (values["end_time"]["end_time"]["selected_date_time"],)
1818
host_id = values["host"]["host"]["selected_user"]
19-
19+
location = values.get("location", {}).get("location", {}).get("value") or "https://hackclub.slack.com/archives/C07TNAZGMHS"
20+
2021
user = client.users_info(user=host_id)
2122
host_name = user["user"]["real_name"]
2223
host_pfp = user["user"]["profile"]["image_192"]
2324

2425
event = env.airtable.create_event(
25-
title[0], md, start_time[0], end_time[0], host_id, host_name, host_pfp
26+
title[0], md, start_time[0], end_time[0], location, host_id, host_name, host_pfp
2627
)
2728
if not event:
2829
client.chat_postEphemeral(

utils/airtable.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def create_event(
1515
description: str,
1616
start_time: str,
1717
end_time: str,
18+
location: str,
1819
host_id: str,
1920
host_name: str,
2021
host_pfp: str,
@@ -27,6 +28,7 @@ def create_event(
2728
start_time, timezone.utc
2829
).isoformat(),
2930
"End Time": datetime.fromtimestamp(end_time, timezone.utc).isoformat(),
31+
"Event Link": location,
3032
"Leader Slack ID": host_id,
3133
"Leader": host_name,
3234
"Avatar": [{"url": host_pfp}],

views/create_event.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,22 @@ def get_create_event_modal(user_id: str):
4646
"element": {"type": "datetimepicker", "action_id": "end_time"},
4747
"label": {"type": "plain_text", "text": "End Time", "emoji": True},
4848
},
49+
{
50+
"type": "input",
51+
"block_id": "location",
52+
"element": {"type": "plain_text_input", "action_id": "location"},
53+
"label": {"type": "plain_text", "text": "Event Location (URL)", "emoji": True},
54+
"optional": True,
55+
},
56+
{
57+
"type": "context",
58+
"elements": [
59+
{
60+
"type": "mrkdwn",
61+
"text": "_Defaults to #high-seas-bulletin channel link if not provided._",
62+
}
63+
],
64+
},
4965
{
5066
"type": "input",
5167
"block_id": "host",

views/propose_event.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,22 @@ def get_propose_event_modal(user_id: str):
4646
"element": {"type": "datetimepicker", "action_id": "end_time"},
4747
"label": {"type": "plain_text", "text": "End Time", "emoji": True},
4848
},
49+
{
50+
"type": "input",
51+
"block_id": "location",
52+
"element": {"type": "plain_text_input", "action_id": "location"},
53+
"label": {"type": "plain_text", "text": "Event Location (URL)", "emoji": True},
54+
"optional": True,
55+
},
56+
{
57+
"type": "context",
58+
"elements": [
59+
{
60+
"type": "mrkdwn",
61+
"text": "_Defaults to #high-seas-bulletin channel link if not provided._",
62+
}
63+
],
64+
},
4965
{
5066
"type": "input",
5167
"block_id": "host",

0 commit comments

Comments
 (0)