mirror of
https://github.com/MichaByte/OnBoard-Live.git
synced 2025-12-06 17:13:40 -05:00
hotfix for slack checkbox limit
This commit is contained in:
parent
492a644f56
commit
ecb8a80f8b
1 changed files with 59 additions and 30 deletions
|
|
@ -259,7 +259,7 @@ async def github_callback(request: Request):
|
||||||
"type": "header",
|
"type": "header",
|
||||||
"text": {
|
"text": {
|
||||||
"type": "plain_text",
|
"type": "plain_text",
|
||||||
"text": "Select your sessions for review!",
|
"text": "Select your sessions for review!\nCopy and paste the lines of sessions that you want associated with this PR into the box!",
|
||||||
"emoji": True,
|
"emoji": True,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -270,31 +270,59 @@ async def github_callback(request: Request):
|
||||||
"type": "mrkdwn",
|
"type": "mrkdwn",
|
||||||
"text": f"Here are all your sessions. Select the ones associated with OnBoard pull request #{pr_id}:",
|
"text": f"Here are all your sessions. Select the ones associated with OnBoard pull request #{pr_id}:",
|
||||||
},
|
},
|
||||||
"accessory": {
|
},
|
||||||
"type": "checkboxes",
|
{
|
||||||
"options": [
|
"type": "section",
|
||||||
json.loads(
|
"text": {
|
||||||
"""{{"text": {{ "type": "mrkdwn", "text": "Your session on {pretty_time}"}}, "description": {{"type": "mrkdwn", "text": "You streamed for {length} {minute_or_minutes}"}}, "value": "checkbox-{filename}"}}""".format(
|
"type": "mrkdwn",
|
||||||
pretty_time=recording,
|
"text": f"{'\n'.join([recording + ' for ' + str(get_recording_duration(recording, user_stream_key)) + 'minutes' for recording in stream_recs])}", # type: ignore
|
||||||
length=get_recording_duration(
|
|
||||||
recording, user_stream_key
|
|
||||||
),
|
|
||||||
minute_or_minutes=(
|
|
||||||
"minute"
|
|
||||||
if get_recording_duration(
|
|
||||||
recording, user_stream_key
|
|
||||||
)
|
|
||||||
== 1
|
|
||||||
else "minutes"
|
|
||||||
),
|
|
||||||
filename=recording,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
for recording in stream_recs
|
|
||||||
],
|
|
||||||
"action_id": "checkboxes",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "input",
|
||||||
|
"block_id": "session-input",
|
||||||
|
"element": {
|
||||||
|
"type": "plain_text_input",
|
||||||
|
"multiline": True,
|
||||||
|
"action_id": "plain_text_input-action",
|
||||||
|
},
|
||||||
|
"label": {
|
||||||
|
"type": "plain_text",
|
||||||
|
"text": "Paste the lines here (DO NOT EDIT THEM, ONE ON EACH LINE)",
|
||||||
|
"emoji": False,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
# "block_id": "session-checks",
|
||||||
|
# "type": "section",
|
||||||
|
# "text": {
|
||||||
|
# "type": "mrkdwn",
|
||||||
|
# "text": f"Here are all your sessions. Select the ones associated with OnBoard pull request #{pr_id}:",
|
||||||
|
# },
|
||||||
|
# "accessory": {
|
||||||
|
# "type": "checkboxes",
|
||||||
|
# "options": [
|
||||||
|
# json.loads(
|
||||||
|
# """{{"text": {{ "type": "mrkdwn", "text": "Your session on {pretty_time}"}}, "description": {{"type": "mrkdwn", "text": "You streamed for {length} {minute_or_minutes}"}}, "value": "checkbox-{filename}"}}""".format(
|
||||||
|
# pretty_time=recording,
|
||||||
|
# length=get_recording_duration(
|
||||||
|
# recording, user_stream_key
|
||||||
|
# ),
|
||||||
|
# minute_or_minutes=(
|
||||||
|
# "minute"
|
||||||
|
# if get_recording_duration(
|
||||||
|
# recording, user_stream_key
|
||||||
|
# )
|
||||||
|
# == 1
|
||||||
|
# else "minutes"
|
||||||
|
# ),
|
||||||
|
# filename=recording,
|
||||||
|
# )
|
||||||
|
# )
|
||||||
|
# for recording in stream_recs
|
||||||
|
# ],
|
||||||
|
# "action_id": "checkboxes",
|
||||||
|
# },
|
||||||
|
# },
|
||||||
{
|
{
|
||||||
"type": "actions",
|
"type": "actions",
|
||||||
"elements": [
|
"elements": [
|
||||||
|
|
@ -379,12 +407,13 @@ async def handle_app_home_opened_events(body, logger, event, client):
|
||||||
@bolt.action("submit_sessions")
|
@bolt.action("submit_sessions")
|
||||||
async def submit_sessions(ack: AsyncAck, body):
|
async def submit_sessions(ack: AsyncAck, body):
|
||||||
await ack()
|
await ack()
|
||||||
selected_sessions_ts: List[str] = [
|
selected_sessions_ts: List[str] = []
|
||||||
i["text"]["text"].split("session on ")[1]
|
print(body["state"]["values"])
|
||||||
for i in body["state"]["values"]["session-checks"]["checkboxes"][
|
for session in body["state"]["values"]["session-input"]["plain_text_input-action"][
|
||||||
"selected_options"
|
"value"
|
||||||
]
|
].split("\n"):
|
||||||
]
|
selected_sessions_ts.append(session.split(" for ")[0])
|
||||||
|
|
||||||
pr_id = int(
|
pr_id = int(
|
||||||
body["message"]["blocks"][1]["text"]["text"].split("#")[1].split(":")[0]
|
body["message"]["blocks"][1]["text"]["text"].split("#")[1].split(":")[0]
|
||||||
) # don't tell my mom she raised a monster
|
) # don't tell my mom she raised a monster
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue