mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-02 16:29:06 +01:00
Merge pull request 'Display tag name as title for a tag with no release [gitea]' (#2547) from algernon/forgejo:gitea/port/tag-name-as-title-if-no-release into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2547 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
This commit is contained in:
commit
c510b7a4a1
3 changed files with 17 additions and 1 deletions
|
@ -184,6 +184,11 @@ func Releases(ctx *context.Context) {
|
||||||
ctx.ServerError("getReleaseInfos", err)
|
ctx.ServerError("getReleaseInfos", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
for _, rel := range releases {
|
||||||
|
if rel.Release.IsTag && rel.Release.Title == "" {
|
||||||
|
rel.Release.Title = rel.Release.TagName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ctx.Data["Releases"] = releases
|
ctx.Data["Releases"] = releases
|
||||||
|
|
||||||
|
@ -295,6 +300,9 @@ func SingleRelease(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
release := releases[0].Release
|
release := releases[0].Release
|
||||||
|
if release.IsTag && release.Title == "" {
|
||||||
|
release.Title = release.TagName
|
||||||
|
}
|
||||||
|
|
||||||
ctx.Data["PageIsSingleTag"] = release.IsTag
|
ctx.Data["PageIsSingleTag"] = release.IsTag
|
||||||
if release.IsTag {
|
if release.IsTag {
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
<span class="ui yellow label">{{ctx.Locale.Tr "repo.release.draft"}}</span>
|
<span class="ui yellow label">{{ctx.Locale.Tr "repo.release.draft"}}</span>
|
||||||
{{else if $release.IsPrerelease}}
|
{{else if $release.IsPrerelease}}
|
||||||
<span class="ui orange label">{{ctx.Locale.Tr "repo.release.prerelease"}}</span>
|
<span class="ui orange label">{{ctx.Locale.Tr "repo.release.prerelease"}}</span>
|
||||||
{{else}}
|
{{else if (not $release.IsTag)}}
|
||||||
<span class="ui green label">{{ctx.Locale.Tr "repo.release.stable"}}</span>
|
<span class="ui green label">{{ctx.Locale.Tr "repo.release.stable"}}</span>
|
||||||
{{end}}
|
{{end}}
|
||||||
</h4>
|
</h4>
|
||||||
|
|
|
@ -7,6 +7,7 @@ package integration
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"code.gitea.io/gitea/models"
|
"code.gitea.io/gitea/models"
|
||||||
|
@ -56,6 +57,13 @@ func TestTagViewWithoutRelease(t *testing.T) {
|
||||||
// Test that the release sub-menu isn't active
|
// Test that the release sub-menu isn't active
|
||||||
releaseLink := htmlDoc.Find(".small-menu-items .item[href*='/releases']")
|
releaseLink := htmlDoc.Find(".small-menu-items .item[href*='/releases']")
|
||||||
assert.False(t, releaseLink.HasClass("active"))
|
assert.False(t, releaseLink.HasClass("active"))
|
||||||
|
|
||||||
|
// Test that the title is displayed
|
||||||
|
releaseTitle := strings.TrimSpace(htmlDoc.Find("h4.release-list-title > a").Text())
|
||||||
|
assert.Equal(t, "no-release", releaseTitle)
|
||||||
|
|
||||||
|
// Test that there is no "Stable" link
|
||||||
|
htmlDoc.AssertElement(t, "h4.release-list-title > span.ui.green.label", false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCreateNewTagProtected(t *testing.T) {
|
func TestCreateNewTagProtected(t *testing.T) {
|
||||||
|
|
Loading…
Reference in a new issue