mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
github_webhook: Update "pull_request unassigned" event fixture.
The older fixture for this event assumed that the "assignee" key
had a value of '{}' if no one was assigned to a PR anymore.
However, that is no longer true because testing with requestbin
showed that in the latest JSON payload for this event, the key
"assignee" now has the value of 'null' (None when converted to
Python) when a user is unassigned from a PR. The current code
didn't handle this correctly. This commit makes sure it does!
Its unclear as to whether the old fixture was simply wrong or
whether GitHub changed its payloads in any way.
This commit is contained in:
@@ -42,14 +42,16 @@ def get_opened_or_update_pull_request_body(payload):
|
||||
def get_assigned_or_unassigned_pull_request_body(payload):
|
||||
# type: (Dict[str, Any]) -> Text
|
||||
pull_request = payload['pull_request']
|
||||
assignee = pull_request.get('assignee', {}).get('login')
|
||||
assignee = pull_request.get('assignee')
|
||||
if assignee is not None:
|
||||
assignee = assignee.get('login')
|
||||
|
||||
base_message = get_pull_request_event_message(
|
||||
get_sender_name(payload),
|
||||
payload['action'],
|
||||
pull_request['html_url'],
|
||||
)
|
||||
if assignee:
|
||||
if assignee is not None:
|
||||
return "{} to {}".format(base_message, assignee)
|
||||
return base_message
|
||||
|
||||
|
||||
Reference in New Issue
Block a user