From f390404b9851ca7b2a90c7d9949a4940a4e88616 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Thu, 9 Mar 2017 09:30:03 +0100 Subject: [PATCH] Issue#4995 Fix problems with multiline commits in the webhooks --- taiga/hooks/bitbucket/event_hooks.py | 1 + taiga/hooks/event_hooks.py | 4 ++-- taiga/hooks/github/event_hooks.py | 3 ++- taiga/hooks/gitlab/event_hooks.py | 1 + taiga/hooks/gogs/event_hooks.py | 3 ++- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/taiga/hooks/bitbucket/event_hooks.py b/taiga/hooks/bitbucket/event_hooks.py index f31b5381..7021f61b 100644 --- a/taiga/hooks/bitbucket/event_hooks.py +++ b/taiga/hooks/bitbucket/event_hooks.py @@ -80,5 +80,6 @@ class PushEventHook(BaseBitBucketEventHook, BasePushEventHook): "commit_id": commit.get("hash", None), "commit_url": commit.get("links", {}).get('html', {}).get('href'), "commit_message": message.strip(), + "commit_short_message": message.split("\n")[0].strip(), }) return result diff --git a/taiga/hooks/event_hooks.py b/taiga/hooks/event_hooks.py index 8ab6e44d..6fa574c4 100644 --- a/taiga/hooks/event_hooks.py +++ b/taiga/hooks/event_hooks.py @@ -154,7 +154,7 @@ class BasePushEventHook(BaseEventHook): ) _status_change_message = _( "{user_text} changed the status from " - "[{platform} commit]({commit_url} \"See commit '{commit_id} - {commit_message}'\")\n\n" + "[{platform} commit]({commit_url} \"See commit '{commit_id} - {commit_short_message}'\")\n\n" " - Status: **{src_status}** → **{dst_status}**" ) _simple_status_change_message = _( @@ -177,7 +177,7 @@ class BasePushEventHook(BaseEventHook): _status_change_message = _( "This {type_name} has been mentioned by {user_text} " - "in the [{platform} commit]({commit_url} \"See commit '{commit_id} - {commit_message}'\") " + "in the [{platform} commit]({commit_url} \"See commit '{commit_id} - {commit_short_message}'\") " "\"{commit_message}\"" ) _simple_status_change_message = _( diff --git a/taiga/hooks/github/event_hooks.py b/taiga/hooks/github/event_hooks.py index 32724a71..6994f528 100644 --- a/taiga/hooks/github/event_hooks.py +++ b/taiga/hooks/github/event_hooks.py @@ -81,7 +81,8 @@ class PushEventHook(BaseGitHubEventHook, BasePushEventHook): "user_url": github_user.get('html_url', None), "commit_id": commit.get("id", None), "commit_url": commit.get("url", None), - "commit_message": commit.get("message", None), + "commit_message": commit.get("message").strip(), + "commit_short_message": commit.get("message").split("\n")[0].strip(), }) return result diff --git a/taiga/hooks/gitlab/event_hooks.py b/taiga/hooks/gitlab/event_hooks.py index 13f0f1e1..903daea4 100644 --- a/taiga/hooks/gitlab/event_hooks.py +++ b/taiga/hooks/gitlab/event_hooks.py @@ -85,5 +85,6 @@ class PushEventHook(BaseGitLabEventHook, BasePushEventHook): "commit_id": commit.get("id", None), "commit_url": commit.get("url", None), "commit_message": commit.get("message").strip(), + "commit_short_message": commit.get("message").split("\n")[0].strip(), }) return result diff --git a/taiga/hooks/gogs/event_hooks.py b/taiga/hooks/gogs/event_hooks.py index 885a668a..e2007ed5 100644 --- a/taiga/hooks/gogs/event_hooks.py +++ b/taiga/hooks/gogs/event_hooks.py @@ -47,6 +47,7 @@ class PushEventHook(BaseGogsEventHook, BasePushEventHook): "user_url": os.path.join(os.path.dirname(os.path.dirname(project_url)), user_name), "commit_id": commit.get("id", None), "commit_url": commit.get("url", None), - "commit_message": commit.get("message", None), + "commit_message": commit.get("message").strip(), + "commit_short_message": commit.get("message").split("\n")[0].strip(), }) return result