aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorCirno the Strongest <1447794+CirnoT@users.noreply.github.com>2020-06-19 09:19:56 +0200
committerGitHub <noreply@github.com>2020-06-19 15:19:56 +0800
commit92a05f87f070b0d2a1e9eb53072e00f0f1c3b69a (patch)
treed072f4c39887579c6ab5547be3717f67cdc9bafb /modules
parentec40e593cfc4d208c6a81fbcb1b4044ce45b956e (diff)
downloadgitea-92a05f87f070b0d2a1e9eb53072e00f0f1c3b69a.tar.gz
gitea-92a05f87f070b0d2a1e9eb53072e00f0f1c3b69a.zip
Use only first line of commit when creating referenced comment (#11960)
* Use only first line of commit when creating referenced comment * Update modules/repofiles/action.go * Display first line only on feeds too Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'modules')
-rw-r--r--modules/repofiles/action.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/repofiles/action.go b/modules/repofiles/action.go
index 44ca285ef0..464249d19b 100644
--- a/modules/repofiles/action.go
+++ b/modules/repofiles/action.go
@@ -8,6 +8,7 @@ import (
"encoding/json"
"fmt"
"html"
+ "strings"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/git"
@@ -111,7 +112,7 @@ func UpdateIssuesCommit(doer *models.User, repo *models.Repository, commits []*r
continue
}
- message := fmt.Sprintf(`<a href="%s/commit/%s">%s</a>`, repo.Link(), c.Sha1, html.EscapeString(c.Message))
+ message := fmt.Sprintf(`<a href="%s/commit/%s">%s</a>`, repo.Link(), c.Sha1, html.EscapeString(strings.SplitN(c.Message, "\n", 2)[0]))
if err = models.CreateRefComment(doer, refRepo, refIssue, message, c.Sha1); err != nil {
return err
}