Show issue title at dashboardmaster
@@ -15,6 +15,7 @@ import ( | |||||
"unicode" | "unicode" | ||||
"github.com/go-xorm/xorm" | "github.com/go-xorm/xorm" | ||||
"github.com/Unknwon/com" | |||||
api "github.com/gogits/go-gogs-client" | api "github.com/gogits/go-gogs-client" | ||||
@@ -136,6 +137,16 @@ func (a Action) GetIssueInfos() []string { | |||||
return strings.SplitN(a.Content, "|", 2) | return strings.SplitN(a.Content, "|", 2) | ||||
} | } | ||||
func (a Action) GetIssueTitle() string { | |||||
issueIndex := com.StrTo(a.GetIssueInfos()[0]).MustInt64() | |||||
issue, err := GetIssueByIndex(a.RepoID, issueIndex) | |||||
if err != nil { | |||||
log.Error(4, "GetIssueByID: %v", err) | |||||
return "500 when get title" | |||||
} | |||||
return issue.Name | |||||
} | |||||
func newRepoAction(e Engine, u *User, repo *Repository) (err error) { | func newRepoAction(e Engine, u *User, repo *Repository) (err error) { | ||||
if err = notifyWatchers(e, &Action{ | if err = notifyWatchers(e, &Action{ | ||||
ActUserID: u.Id, | ActUserID: u.Id, | ||||
@@ -24,7 +24,7 @@ | |||||
{{$.i18n.Tr "action.push_tag" .GetRepoLink .GetBranch .GetRepoPath | Str2html}} | {{$.i18n.Tr "action.push_tag" .GetRepoLink .GetBranch .GetRepoPath | Str2html}} | ||||
{{else if eq .GetOpType 10}} | {{else if eq .GetOpType 10}} | ||||
{{ $index := index .GetIssueInfos 0}} | {{ $index := index .GetIssueInfos 0}} | ||||
{{$.i18n.Tr "action.comment_issue" .GetRepoLink $index .GetRepoPath | Str2html}} | |||||
{{$.i18n.Tr "action.comment_issue" .GetRepoLink $index .GetRepoPath | Str2html}} – {{.GetIssueTitle}} | |||||
{{else if eq .GetOpType 11}} | {{else if eq .GetOpType 11}} | ||||
{{ $index := index .GetIssueInfos 0}} | {{ $index := index .GetIssueInfos 0}} | ||||
{{$.i18n.Tr "action.merge_pull_request" .GetRepoLink $index .GetRepoPath | Str2html}} | {{$.i18n.Tr "action.merge_pull_request" .GetRepoLink $index .GetRepoPath | Str2html}} | ||||