[fix] comment can be None

This commit is contained in:
Laurent Peuch 2019-02-06 13:49:40 +01:00
parent 5d921a87e9
commit 692117f7af

View file

@ -213,13 +213,13 @@ async def github(request):
if action == "submitted": if action == "submitted":
state = request.json["review"]["state"] state = request.json["review"]["state"]
comment = request.json["review"]["body"].replace("\r\n", " ") comment = request.json["review"]["body"]
if comment and len(comment) > 120: if comment and len(comment) > 120:
comment = ": " + comment[:120] + "..." comment = ": " + comment[:120].replace("\r\n", " ") + "..."
elif not comment: elif not comment:
comment = "" comment = ""
else: else:
comment = ": " + comment comment = ": " + comment.replace("\r\n", " ")
notify(f"[{repository}] @{user} {state} pull request #{pull_request_number} {pull_request_title}{comment} {url}") notify(f"[{repository}] @{user} {state} pull request #{pull_request_number} {pull_request_title}{comment} {url}")