Skip to content

Commit

Permalink
Merge pull request #46 from sopel-irc/demilestoned-details
Browse files Browse the repository at this point in the history
formatting: provide name for `demilestoned` events too
  • Loading branch information
dgw authored Nov 4, 2019
2 parents 3f7dc87 + 11c41bd commit f3aa22f
Showing 1 changed file with 3 additions and 12 deletions.
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

0 comments on commit f3aa22f

Please sign in to comment.