]> source.dussan.org Git - gitea.git/commitdiff
Fix a couple of issues with a feeds (#14897) (#14903)
author6543 <6543@obermui.de>
Sat, 6 Mar 2021 05:13:38 +0000 (06:13 +0100)
committerGitHub <noreply@github.com>
Sat, 6 Mar 2021 05:13:38 +0000 (06:13 +0100)
Backport (#14897)

witch fix couple of issues with feeds

modules/templates/helper.go
templates/user/dashboard/feeds.tmpl

index 63be27d98735af91aa31ac7c85d8e78529905f1f..cd6f28fa0e93e5cc8d0d6b2fc14e05be58796f7c 100644 (file)
@@ -689,6 +689,11 @@ func ActionIcon(opType models.ActionType) string {
 // ActionContent2Commits converts action content to push commits
 func ActionContent2Commits(act Actioner) *repository.PushCommits {
        push := repository.NewPushCommits()
+
+       if act == nil || act.GetContent() == "" {
+               return push
+       }
+
        if err := json.Unmarshal([]byte(act.GetContent()), push); err != nil {
                log.Error("json.Unmarshal:\n%s\nERROR: %v", act.GetContent(), err)
        }
index 739caeba5f2e0ee021c0a0a08eaed6c28762cf19..2748ea40229acd4e3867dc6439743d3a22d481f3 100644 (file)
@@ -96,7 +96,8 @@
                                                <span class="text truncate issue title">{{index .GetIssueInfos 1 | RenderEmoji}}</span>
                                        {{else if or (eq .GetOpType 10) (eq .GetOpType 21) (eq .GetOpType 22) (eq .GetOpType 23)}}
                                                <a href="{{.GetCommentLink}}" class="text truncate issue title">{{.GetIssueTitle | RenderEmoji}}</a>
-                                               <p class="text light grey">{{index .GetIssueInfos 1 | RenderEmoji}}</p>
+                                               {{$comment := index .GetIssueInfos 1}}
+                                               {{if gt (len $comment) 0}}<p class="text light grey">{{$comment | RenderEmoji}}</p>{{end}}
                                        {{else if eq .GetOpType 11}}
                                                <p class="text light grey">{{index .GetIssueInfos 1}}</p>
                                        {{else if or (eq .GetOpType 12) (eq .GetOpType 13) (eq .GetOpType 14) (eq .GetOpType 15)}}