Skip to content

Commit 20f13bf

Browse files
authored
Fix a couple of issues with a feeds (#14897)
@CirnoT spotted a couple of issues with feeds on discord. This PR fixes both of these.
1 parent fd4b309 commit 20f13bf

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

modules/templates/helper.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,10 @@ func ActionIcon(opType models.ActionType) string {
817817
func ActionContent2Commits(act Actioner) *repository.PushCommits {
818818
push := repository.NewPushCommits()
819819

820+
if act == nil || act.GetContent() == "" {
821+
return push
822+
}
823+
820824
json := jsoniter.ConfigCompatibleWithStandardLibrary
821825
if err := json.Unmarshal([]byte(act.GetContent()), push); err != nil {
822826
log.Error("json.Unmarshal:\n%s\nERROR: %v", act.GetContent(), err)

templates/user/dashboard/feeds.tmpl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@
110110
<span class="text truncate issue title">{{index .GetIssueInfos 1 | RenderEmoji}}</span>
111111
{{else if or (eq .GetOpType 10) (eq .GetOpType 21) (eq .GetOpType 22) (eq .GetOpType 23)}}
112112
<a href="{{.GetCommentLink}}" class="text truncate issue title">{{.GetIssueTitle | RenderEmoji}}</a>
113-
<p class="text light grey">{{index .GetIssueInfos 1 | RenderEmoji}}</p>
113+
{{$comment := index .GetIssueInfos 1}}
114+
{{if gt (len $comment) 0}}<p class="text light grey">{{$comment | RenderEmoji}}</p>{{end}}
114115
{{else if eq .GetOpType 11}}
115116
<p class="text light grey">{{index .GetIssueInfos 1}}</p>
116117
{{else if or (eq .GetOpType 12) (eq .GetOpType 13) (eq .GetOpType 14) (eq .GetOpType 15)}}

0 commit comments

Comments
 (0)