mirror of
https://github.com/YunoHost/webhooks.git
synced 2024-09-03 19:56:54 +02:00
[mod] avoid \n in bodies
This commit is contained in:
parent
c82e5a55b2
commit
85777b2c7a
1 changed files with 5 additions and 5 deletions
10
server.py
10
server.py
|
@ -79,7 +79,7 @@ async def github(request):
|
||||||
repository = request.json["repository"]["name"]
|
repository = request.json["repository"]["name"]
|
||||||
user = request.json["comment"]["user"]["login"]
|
user = request.json["comment"]["user"]["login"]
|
||||||
commit_short_id = request.json["comment"]["commit_id"][:7]
|
commit_short_id = request.json["comment"]["commit_id"][:7]
|
||||||
comment = request.json["comment"]["body"]
|
comment = request.json["comment"]["body"].replace("\n", " ")
|
||||||
|
|
||||||
notify(f"[{repository}] @{user} comment on commit {commit_short_id}: {comment} {url}")
|
notify(f"[{repository}] @{user} comment on commit {commit_short_id}: {comment} {url}")
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ async def github(request):
|
||||||
url = request.json["comment"]["html_url"]
|
url = request.json["comment"]["html_url"]
|
||||||
issue_number = request.json["issue"]["number"]
|
issue_number = request.json["issue"]["number"]
|
||||||
issue_title = request.json["issue"]["title"]
|
issue_title = request.json["issue"]["title"]
|
||||||
comment = request.json["comment"]["body"]
|
comment = request.json["comment"]["body"].replace("\n", " ")
|
||||||
|
|
||||||
if len(comment) > 120:
|
if len(comment) > 120:
|
||||||
comment = comment[:120] + "..."
|
comment = comment[:120] + "..."
|
||||||
|
@ -190,7 +190,7 @@ async def github(request):
|
||||||
repository = request.json["repository"]["name"]
|
repository = request.json["repository"]["name"]
|
||||||
user = request.json["sender"]["login"]
|
user = request.json["sender"]["login"]
|
||||||
pull_request_number = request.json["pull_request"]["number"]
|
pull_request_number = request.json["pull_request"]["number"]
|
||||||
comment = request.json["comment"]["body"]
|
comment = request.json["comment"]["body"].replace("\n", " ")
|
||||||
url = request.json["comment"]["html_url"]
|
url = request.json["comment"]["html_url"]
|
||||||
|
|
||||||
if len(comment) > 120:
|
if len(comment) > 120:
|
||||||
|
@ -208,7 +208,7 @@ 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"]
|
comment = request.json["review"]["body"].replace("\n", " ")
|
||||||
if comment and len(comment) > 120:
|
if comment and len(comment) > 120:
|
||||||
comment = ": " + comment[:120] + "..."
|
comment = ": " + comment[:120] + "..."
|
||||||
elif not comment:
|
elif not comment:
|
||||||
|
@ -229,7 +229,7 @@ async def github(request):
|
||||||
pull_request_number = request.json["pull_request"]["number"]
|
pull_request_number = request.json["pull_request"]["number"]
|
||||||
pull_request_title = request.json["pull_request"]["title"]
|
pull_request_title = request.json["pull_request"]["title"]
|
||||||
url = request.json["pull_request"]["html_url"]
|
url = request.json["pull_request"]["html_url"]
|
||||||
comment = request.json["pull_request"]["body"]
|
comment = request.json["pull_request"]["body"].replace("\n", " ")
|
||||||
|
|
||||||
if action in ("opened", "edited", "deleted", "transferred", "pinned",
|
if action in ("opened", "edited", "deleted", "transferred", "pinned",
|
||||||
"unpinned", "reopened"):
|
"unpinned", "reopened"):
|
||||||
|
|
Loading…
Reference in a new issue