]> source.dussan.org Git - gitea.git/commitdiff
Fix a couple of issues with a feeds (#14897)
authorzeripath <art27@cantab.net>
Sat, 6 Mar 2021 04:09:49 +0000 (04:09 +0000)
committerGitHub <noreply@github.com>
Sat, 6 Mar 2021 04:09:49 +0000 (05:09 +0100)
@CirnoT spotted a couple of issues with feeds on discord.

This PR fixes both of these.

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

index d3f6b8e06f97d6e61bd88215aa011e801d4d32fa..ab66cc72826933607ca9709718489a68b96a8ef9 100644 (file)
@@ -817,6 +817,10 @@ func ActionIcon(opType models.ActionType) string {
 func ActionContent2Commits(act Actioner) *repository.PushCommits {
        push := repository.NewPushCommits()
 
+       if act == nil || act.GetContent() == "" {
+               return push
+       }
+
        json := jsoniter.ConfigCompatibleWithStandardLibrary
        if err := json.Unmarshal([]byte(act.GetContent()), push); err != nil {
                log.Error("json.Unmarshal:\n%s\nERROR: %v", act.GetContent(), err)
index d25920a24ee4eea5fabcbd510ff55de0ad0ba8b6..057a4a76256e04383a3892303f0eda10ca2d31a3 100644 (file)
                                                <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)}}