Skip to content

Commit 5f123b0

Browse files
committed
show author for releases created outside Gitea UI.
Also show the number of commits behind the default branch for tags created outside the UI don't show the tag date again for tags pushed to the repo. Since it is already on the sidebar and looks like duplication
1 parent 2019983 commit 5f123b0

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

models/release.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,12 @@ func createTag(gitRepo *git.Repository, rel *Release) error {
142142
if err != nil {
143143
return fmt.Errorf("CommitsCount: %v", err)
144144
}
145+
146+
u, err := GetUserByEmail(commit.Author.Email)
147+
if err == nil {
148+
rel.PublisherID = u.ID
149+
}
150+
145151
} else {
146152
rel.CreatedUnix = util.TimeStampNow()
147153
}

templates/repo/release/list.tmpl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@
4040
<h4>
4141
<a href="{{$.RepoLink}}/src/tag/{{.TagName | EscapePound}}" rel="nofollow"><i class="tag icon"></i> {{.TagName}}</a>
4242
</h4>
43+
<p class="text grey">
44+
{{ if gt .Publisher.ID 0 }}
45+
<span class="author">
46+
<img class="img-10" src="{{.Publisher.RelAvatarLink}}">
47+
<a href="{{AppSubUrl}}/{{.Publisher.Name}}">{{.Publisher.Name}}</a>
48+
</span>
49+
{{ end }}
50+
<span class="ahead">{{$.i18n.Tr "repo.release.ahead" .NumCommitsBehind $.Repository.DefaultBranch | Str2html}}</span>
51+
</p>
4352
<div class="download">
4453
{{if $.Permission.CanRead $.UnitTypeCode}}
4554
<a href="{{$.RepoLink}}/src/commit/{{.Sha1}}" rel="nofollow"><i class="code icon"></i> {{ShortSha .Sha1}}</a>

0 commit comments

Comments
 (0)