mirror of https://github.com/zulip/zulip.git
webhooks/gci: Support 'outoftime' event.
This commit adds support for the 'outoftime' event. Such an event is triggered when the task deadline for a particular task has passed.
This commit is contained in:
parent
a028097266
commit
457c5a7735
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"task_definition_url": "https://0.0.0.0:8000/dashboard/tasks/6694926301528064/",
|
||||
"event_type": "outoftime",
|
||||
"task_definition_name": "Sails unspread it stopped at kearney",
|
||||
"task_instance_url": "https://0.0.0.0:8000/dashboard/task-instances/6694926301528064/",
|
||||
"id": "1f4bab4d1820400f9b50ed8bf2bb03b3",
|
||||
"task_instance": 6694926301528064,
|
||||
"author_is_student":false,
|
||||
"organization": "Zulip",
|
||||
"task_claimed_by": "student-yqqtag",
|
||||
"author":"Google Code-in System",
|
||||
"time":1516125627.2782099247
|
||||
}
|
|
@ -61,3 +61,9 @@ class GoogleCodeInTests(WebhookTestCase):
|
|||
expected_message = u'**eeshangarg** unassigned **student-yqqtag** from the task [Sails unspread it stopped at kearney](https://codein.withgoogle.com/dashboard/task-instances/6296903092273152/).'
|
||||
self.send_and_test_stream_message('student_unassigned_by_mentor',
|
||||
expected_subject, expected_message)
|
||||
|
||||
def test_outoftime_event_message(self) -> None:
|
||||
expected_subject = u'student-yqqtag'
|
||||
expected_message = u'The deadline for the task [Sails unspread it stopped at kearney](https://codein.withgoogle.com/dashboard/task-instances/6694926301528064/) has passed.'
|
||||
self.send_and_test_stream_message('task_deadline_has_passed',
|
||||
expected_subject, expected_message)
|
||||
|
|
|
@ -94,6 +94,12 @@ def get_unassign_event_body(payload: Dict[Text, Any]) -> Text:
|
|||
task_url=build_instance_url(payload['task_instance']),
|
||||
)
|
||||
|
||||
def get_outoftime_event_body(payload: Dict[Text, Any]) -> Text:
|
||||
return u'The deadline for the task [{task_name}]({task_url}) has passed.'.format(
|
||||
task_name=payload['task_definition_name'],
|
||||
task_url=build_instance_url(payload['task_instance']),
|
||||
)
|
||||
|
||||
@api_key_only_webhook_view("Google-Code-In")
|
||||
@has_request_variables
|
||||
def api_gci_webhook(request: HttpRequest, user_profile: UserProfile, stream: Text=REQ(default='gci'),
|
||||
|
@ -117,6 +123,7 @@ EVENTS_FUNCTION_MAPPER = {
|
|||
'comment': get_comment_event_body,
|
||||
'extend': get_extend_event_body,
|
||||
'needswork': get_needswork_event_body,
|
||||
'outoftime': get_outoftime_event_body,
|
||||
'submit': get_submit_event_body,
|
||||
'unassign': get_unassign_event_body,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue