Skip to content

Commit 368497a

Browse files
committed
Add button to clear selected mentor on /mentor form
1 parent b6a62c4 commit 368497a

4 files changed

Lines changed: 21 additions & 4 deletions

File tree

pybot/endpoints/slack/actions/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
set_requested_mentor,
1313
set_requested_service,
1414
set_group,
15+
clear_mentor,
1516
)
1617
from .new_member import (
1718
member_greeted,
@@ -50,11 +51,13 @@ def create_endpoints(plugin):
5051
"mentor_request_submit", cancel_mentor_request, name="cancel", wait=False
5152
)
5253

53-
# plugin.on_action("mentor_request_update", mentor_request_update, wait=False)
5454
plugin.on_action("mentor_request_update", add_skillset, name="skillset", wait=False)
5555
plugin.on_action(
5656
"mentor_request_update", clear_skillsets, name="clearSkills", wait=False
5757
)
58+
plugin.on_action(
59+
"mentor_request_update", clear_mentor, name="clearMentor", wait=False
60+
)
5861
plugin.on_action(
5962
"mentor_request_update", open_details_dialog, name="addDetails", wait=False
6063
)

pybot/endpoints/slack/actions/mentor_request.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,15 @@ async def clear_skillsets(action: Action, app: SirBot):
7373
await request.update_message(slack)
7474

7575

76+
async def clear_mentor(action: Action, app: SirBot):
77+
slack = app.plugins["slack"].api
78+
79+
request = MentorRequest(action)
80+
request.mentor = ""
81+
82+
await request.update_message(slack)
83+
84+
7685
async def set_group(action: Action, app: SirBot):
7786
group = MentorRequest.selected_option(action)
7887
request = MentorRequest(action)

pybot/endpoints/slack/message_templates/commands.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,15 @@ def mentor_request_attachments(services, mentors, skillsets):
6565
"text": "Specific Mentor",
6666
"name": "mentor",
6767
"options": [
68-
{"text": "None", "value": "None"},
6968
*[{"text": mentor, "value": mentor} for mentor in mentors],
7069
],
71-
}
70+
},
71+
{
72+
"type": "button",
73+
"text": "Clear Mentor",
74+
"name": "clearMentor",
75+
"value": "clearMentor",
76+
},
7277
],
7378
},
7479
{

pybot/endpoints/slack/message_templates/mentor_request.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ def submission_error(self, airtable_response, slack: SlackAPI):
154154

155155
def submission_complete(self, slack: SlackAPI):
156156
done_attachment = self.attachments[AttachmentIndex.SUBMIT]
157-
# done_attachment["text"] = "Request submitted successfully!"
158157

158+
# done_attachment["text"] = "Request submitted successfully!"
159159
done_attachment["text"] = "Request submitted successfully! (not really)"
160160
done_attachment["actions"] = [
161161
{"type": "button", "text": "Dismiss", "name": "cancel", "value": "cancel"}

0 commit comments

Comments
 (0)