Skip to content
This repository was archived by the owner on Nov 19, 2025. It is now read-only.

Commit dc038b7

Browse files
committed
Fix push events with multiline commit message
1 parent ab8f9ae commit dc038b7

5 files changed

Lines changed: 15 additions & 18 deletions

File tree

mattermost_gitlab/event_formatter.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ def format(self):
7272
if self.data['total_commits_count'] > 1:
7373
description += "s"
7474

75-
suffix = ''
75+
suffix = '.'
7676
if len(self.data['commits']) > 0:
77-
suffix = '\n'
77+
suffix = ':\n'
7878

79-
text = '%s pushed %s into the `%s` branch for project [%s](%s).%s' % (
79+
text = '%s pushed %s into the `%s` branch for project [%s](%s)%s' % (
8080
self.data['user_name'],
8181
description,
8282
self.data['ref'],
@@ -85,10 +85,12 @@ def format(self):
8585
suffix
8686
)
8787
for val in self.data['commits']:
88-
text += "[%s](%s)" % (val['message'], val['url'])
88+
header = val['message'].splitlines()[0]
89+
text += "* [%s](%s)\n" % (header, val['url'])
8990

9091
return text
9192

93+
9294
class IssueEvent(BaseEvent):
9395

9496
@property
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Example User pushed 1 commit into the `refs/heads/dev` branch for project [example repository](http://gitlab.example.com/root/example-repository).
2-
[bump2 with unicode ⇗ ⟾](http://gitlab.example.com/root/example-repository/commit/c5ccce8cd46a277dd0723ad5954f44a562c5c67e)
1+
Example User pushed 1 commit into the `refs/heads/dev` branch for project [example repository](http://gitlab.example.com/root/example-repository):
2+
* [bump2 with unicode ⇗ ⟾](http://gitlab.example.com/root/example-repository/commit/c5ccce8cd46a277dd0723ad5954f44a562c5c67e)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Example User pushed 1 commit into the `refs/heads/master` branch for project [example repository](http://gitlab.example.com/root/example-repository).
2-
[bump](http://gitlab.example.com/root/example-repository/commit/2e03a84ed69727606a8d662b60125c6c48f6484f)
1+
Example User pushed 1 commit into the `refs/heads/master` branch for project [example repository](http://gitlab.example.com/root/example-repository):
2+
* [bump](http://gitlab.example.com/root/example-repository/commit/2e03a84ed69727606a8d662b60125c6c48f6484f)
Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
Example User pushed 2 commits into the `refs/heads/master` branch for project [example repository](http://gitlab.example.com/root/example-repository).
2-
[bump2 with unicode ⇗ ⟾](http://gitlab.example.com/root/example-repository/commit/c5ccce8cd46a277dd0723ad5954f44a562c5c67e)[Merge branch 'dev' into 'master'
3-
4-
merge cool feature
5-
6-
New description
7-
8-
See merge request !1](http://gitlab.example.com/root/example-repository/commit/d2b94519881dc201da8151d6344eab0055f15a44)
1+
Example User pushed 2 commits into the `refs/heads/master` branch for project [example repository](http://gitlab.example.com/root/example-repository):
2+
* [bump2 with unicode ⇗ ⟾](http://gitlab.example.com/root/example-repository/commit/c5ccce8cd46a277dd0723ad5954f44a562c5c67e)
3+
* [Merge branch 'dev' into 'master'](http://gitlab.example.com/root/example-repository/commit/d2b94519881dc201da8151d6344eab0055f15a44)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Example User pushed the first commit into the `refs/heads/master` branch for project [example repository](http://gitlab.example.com/root/example-repository).
2-
[Create project](http://gitlab.example.com/root/example-repository/commit/33477153c450b1ce27025406b9e1e3c6de16c3b9)
1+
Example User pushed the first commit into the `refs/heads/master` branch for project [example repository](http://gitlab.example.com/root/example-repository):
2+
* [Create project](http://gitlab.example.com/root/example-repository/commit/33477153c450b1ce27025406b9e1e3c6de16c3b9)

0 commit comments

Comments
 (0)