diff --git a/zerver/webhooks/gci/fixtures/student_commented_on_task.json b/zerver/webhooks/gci/fixtures/student_commented_on_task.json index ace421fd14..5906aa612a 100644 --- a/zerver/webhooks/gci/fixtures/student_commented_on_task.json +++ b/zerver/webhooks/gci/fixtures/student_commented_on_task.json @@ -1,11 +1,11 @@ { "author_is_student": true, "task_definition_name": "Sails unspread it stopped at kearney", - "type": "comment", + "event_type": "comment", "task_instance": 6296903092273152, "task_claimed_by": "student-yqqtag", "time": 1506475323.256627, - "uuid": "1f4bab4d1820400f9b50ed8bf2bb03b3", + "id": "1f4bab4d1820400f9b50ed8bf2bb03b3", "author": "student-yqqtag", "task_instance_url": "https://0.0.0.0:8000/dashboard/task-instances/6694926301528064/", "task_definition_url": "https://0.0.0.0:8000/dashboard/tasks/6694926301528064/" diff --git a/zerver/webhooks/gci/fixtures/task_abandoned_by_student.json b/zerver/webhooks/gci/fixtures/task_abandoned_by_student.json index 3445505e38..fe4d32e711 100644 --- a/zerver/webhooks/gci/fixtures/task_abandoned_by_student.json +++ b/zerver/webhooks/gci/fixtures/task_abandoned_by_student.json @@ -1,11 +1,11 @@ { "author_is_student": true, "task_definition_name": "Sails unspread it stopped at kearney", - "type": "abandon", + "event_type": "abandon", "task_instance": 6296903092273152, "task_claimed_by": "student-yqqtag", "time": 1506475323.256627, - "uuid": "1f4bab4d1820400f9b50ed8bf2bb03b3", + "id": "1f4bab4d1820400f9b50ed8bf2bb03b3", "author": "student-yqqtag", "task_instance_url": "https://0.0.0.0:8000/dashboard/task-instances/6694926301528064/", "task_definition_url": "https://0.0.0.0:8000/dashboard/tasks/6694926301528064/" diff --git a/zerver/webhooks/gci/fixtures/task_approved_by_mentor.json b/zerver/webhooks/gci/fixtures/task_approved_by_mentor.json index dcab43a198..e288b907ae 100644 --- a/zerver/webhooks/gci/fixtures/task_approved_by_mentor.json +++ b/zerver/webhooks/gci/fixtures/task_approved_by_mentor.json @@ -1,11 +1,11 @@ { "author_is_student": false, "task_definition_name": "Sails unspread it stopped at kearney", - "type": "approve", + "event_type": "approve", "task_instance": 6296903092273152, "task_claimed_by": "student-yqqtag", "time": 1506475323.256627, - "uuid": "1f4bab4d1820400f9b50ed8bf2bb03b3", + "id": "1f4bab4d1820400f9b50ed8bf2bb03b3", "author": "eeshangarg", "task_instance_url": "https://0.0.0.0:8000/dashboard/task-instances/6694926301528064/", "task_definition_url": "https://0.0.0.0:8000/dashboard/tasks/6694926301528064/" diff --git a/zerver/webhooks/gci/fixtures/task_claimed_by_student.json b/zerver/webhooks/gci/fixtures/task_claimed_by_student.json index c14b9ee7a6..774a419137 100644 --- a/zerver/webhooks/gci/fixtures/task_claimed_by_student.json +++ b/zerver/webhooks/gci/fixtures/task_claimed_by_student.json @@ -1,11 +1,11 @@ { "author_is_student": true, "task_definition_name": "Sails unspread it stopped at kearney", - "type": "claim", + "event_type": "claim", "task_instance": 6296903092273152, "task_claimed_by": "student-yqqtag", "time": 1506475323.256627, - "uuid": "1f4bab4d1820400f9b50ed8bf2bb03b3", + "id": "1f4bab4d1820400f9b50ed8bf2bb03b3", "author": "student-yqqtag", "task_instance_url": "https://0.0.0.0:8000/dashboard/task-instances/6694926301528064/", "task_definition_url": "https://0.0.0.0:8000/dashboard/tasks/6694926301528064/" diff --git a/zerver/webhooks/gci/fixtures/task_submitted_by_student.json b/zerver/webhooks/gci/fixtures/task_submitted_by_student.json index b5342d54d2..34608ff621 100644 --- a/zerver/webhooks/gci/fixtures/task_submitted_by_student.json +++ b/zerver/webhooks/gci/fixtures/task_submitted_by_student.json @@ -1,11 +1,11 @@ { "author_is_student": true, "task_definition_name": "Sails unspread it stopped at kearney", - "type": "submit", + "event_type": "submit", "task_instance": 6296903092273152, "task_claimed_by": "student-yqqtag", "time": 1506475323.256627, - "uuid": "1f4bab4d1820400f9b50ed8bf2bb03b3", + "id": "1f4bab4d1820400f9b50ed8bf2bb03b3", "author": "student-yqqtag", "task_instance_url": "https://0.0.0.0:8000/dashboard/task-instances/6694926301528064/", "task_definition_url": "https://0.0.0.0:8000/dashboard/tasks/6694926301528064/" diff --git a/zerver/webhooks/gci/view.py b/zerver/webhooks/gci/view.py index f6657a3082..9c7909b737 100644 --- a/zerver/webhooks/gci/view.py +++ b/zerver/webhooks/gci/view.py @@ -18,7 +18,7 @@ def get_abandon_event_body(payload): # type: (Dict[Text, Any]) -> Text return GCI_MESSAGE_TEMPLATE.format( actor=payload['task_claimed_by'], - action='{}ed'.format(payload['type']), + action='{}ed'.format(payload['event_type']), task_name=payload['task_definition_name'], task_url=payload['task_definition_url'], ) @@ -27,7 +27,7 @@ def get_submit_event_body(payload): # type: (Dict[Text, Any]) -> Text return GCI_MESSAGE_TEMPLATE.format( actor=payload['task_claimed_by'], - action='{}ted'.format(payload['type']), + action='{}ted'.format(payload['event_type']), task_name=payload['task_definition_name'], task_url=payload['task_definition_url'], ) @@ -36,7 +36,7 @@ def get_comment_event_body(payload): # type: (Dict[Text, Any]) -> Text return GCI_MESSAGE_TEMPLATE.format( actor=payload['author'], - action='{}ed on'.format(payload['type']), + action='{}ed on'.format(payload['event_type']), task_name=payload['task_definition_name'], task_url=payload['task_definition_url'], ) @@ -45,7 +45,7 @@ def get_claim_event_body(payload): # type: (Dict[Text, Any]) -> Text return GCI_MESSAGE_TEMPLATE.format( actor=payload['task_claimed_by'], - action='{}ed'.format(payload['type']), + action='{}ed'.format(payload['event_type']), task_name=payload['task_definition_name'], task_url=payload['task_definition_url'], ) @@ -54,7 +54,7 @@ def get_approve_event_body(payload): # type: (Dict[Text, Any]) -> Text return GCI_MESSAGE_TEMPLATE.format( actor=payload['author'], - action='{}d'.format(payload['type']), + action='{}d'.format(payload['event_type']), task_name=payload['task_definition_name'], task_url=payload['task_definition_url'], ) @@ -86,7 +86,7 @@ EVENTS_FUNCTION_MAPPER = { def get_event(payload): # type: (Dict[Text, Any]) -> Optional[Text] - event = payload['type'] + event = payload['event_type'] if event in EVENTS_FUNCTION_MAPPER: return event