Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

formatting: provide name for demilestoned events too #46

Merged
merged 1 commit into from
Nov 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions sopel_modules/github/formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,24 +305,15 @@ def fmt_issue_milestone_message(payload=None):
payload = current_payload

added = payload['action'] == 'milestoned'
# GitHub doesn't send the milestone details with a "demilestoned" payload,
# so we can't tell which one was removed… See forum thread, which will
# hopefully get a response from GitHub staff someday:
# https://github.saobby.my.eu.orgmunity/t5/GitHub-API-Development-and/Webhooks-quot-demilestoned-quot-payload-does-not-include-removed/m-p/23620
stone = (
"the {} milestone".format(payload['issue']['milestone']['title'])
if added
else "its milestone"
)

return '[{}] {} {} {} #{} {} {}'.format(

return '[{}] {} {} {} #{} {} the {} milestone'.format(
fmt_repo(payload['repository']['name']),
fmt_name(payload['sender']['login']),
'added' if added else 'removed',
get_issue_type(payload),
get_issue_or_pr_number(payload),
'to' if added else 'from',
stone)
payload['milestone']['title'])


def fmt_issue_comment_summary_message(payload=None):
Expand Down