mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-09-30 19:22:08 +00:00
Consolidate tag release user display with issue comments
Increase consistency of rendering the ghost user, by re-using the same template. Also add a tooltip to the shared template, to explain the ghost user. Closes: #5630
This commit is contained in:
parent
dfe64e53d0
commit
33b9bf20bc
4 changed files with 35 additions and 3 deletions
|
@ -102,6 +102,7 @@
|
||||||
"admin.dashboard.cleanup_offline_runners": "Cleanup offline runners",
|
"admin.dashboard.cleanup_offline_runners": "Cleanup offline runners",
|
||||||
"settings.visibility.description": "Profile visibility affects others' ability to access your non-private repositories. <a href=\"%s\" target=\"_blank\">Learn more</a>",
|
"settings.visibility.description": "Profile visibility affects others' ability to access your non-private repositories. <a href=\"%s\" target=\"_blank\">Learn more</a>",
|
||||||
"avatar.constraints_hint": "Custom avatar may not exceed %[1]s in size or be larger than %[2]dx%[3]d pixels",
|
"avatar.constraints_hint": "Custom avatar may not exceed %[1]s in size or be larger than %[2]dx%[3]d pixels",
|
||||||
|
"user.ghost.tooltip": "This user has been deleted, or cannot be matched.",
|
||||||
"og.repo.summary_card.alt_description": "Summary card of repository %[1]s, described as: %[2]s",
|
"og.repo.summary_card.alt_description": "Summary card of repository %[1]s, described as: %[2]s",
|
||||||
"meta.last_line": "Thank you for translating Forgejo! This line isn't seen by the users but it serves other purposes in the translation management. You can place a fun fact in the translation instead of translating it."
|
"meta.last_line": "Thank you for translating Forgejo! This line isn't seen by the users but it serves other purposes in the translation management. You can place a fun fact in the translation instead of translating it."
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,9 +42,10 @@
|
||||||
{{svg (MigrationIcon $release.Repo.GetOriginalURLHostname) 20 "tw-mr-1"}}{{$release.OriginalAuthor}}
|
{{svg (MigrationIcon $release.Repo.GetOriginalURLHostname) 20 "tw-mr-1"}}{{$release.OriginalAuthor}}
|
||||||
{{else if $release.Publisher}}
|
{{else if $release.Publisher}}
|
||||||
{{ctx.AvatarUtils.Avatar $release.Publisher 20 "tw-mr-1"}}
|
{{ctx.AvatarUtils.Avatar $release.Publisher 20 "tw-mr-1"}}
|
||||||
<a href="{{$release.Publisher.HomeLink}}">{{$release.Publisher.GetDisplayName}}</a>
|
{{template "shared/user/authorlink" $release.Publisher}}
|
||||||
{{else}}
|
{{else}}
|
||||||
Ghost
|
<!-- Fake the Ghost user -->
|
||||||
|
{{template "shared/user/authorlink" (dict "ID" -1)}}
|
||||||
{{end}}
|
{{end}}
|
||||||
</span>
|
</span>
|
||||||
<span class="released">
|
<span class="released">
|
||||||
|
|
|
@ -1 +1,7 @@
|
||||||
<a class="author text black tw-font-semibold muted"{{if gt .ID 0}} href="{{.HomeLink}}"{{end}}>{{.GetDisplayName}}</a>{{if .IsBot}}<span class="ui basic label tw-p-1 tw-align-baseline">bot</span>{{end}}
|
{{if eq .ID -1}}
|
||||||
|
<a class="author text black tw-font-semibold muted"
|
||||||
|
data-tooltip-content="{{ctx.Locale.Tr "user.ghost.tooltip"}}">Ghost</a>
|
||||||
|
{{else}}
|
||||||
|
<a class="author text black tw-font-semibold muted"{{if gt .ID 0}} href="{{.HomeLink}}"{{end}}>{{.GetDisplayName}}</a>
|
||||||
|
{{if .IsBot}}<span class="ui basic label tw-p-1 tw-align-baseline">bot</span>{{end}}
|
||||||
|
{{end}}
|
||||||
|
|
|
@ -54,6 +54,30 @@ func TestTagViewWithoutRelease(t *testing.T) {
|
||||||
|
|
||||||
// Test that there is no "Stable" link
|
// Test that there is no "Stable" link
|
||||||
htmlDoc.AssertElement(t, "h4.release-list-title > span.ui.green.label", false)
|
htmlDoc.AssertElement(t, "h4.release-list-title > span.ui.green.label", false)
|
||||||
|
|
||||||
|
// Test that the correct user is linked
|
||||||
|
ownerLinkHref, _ := htmlDoc.Find("a.author").Attr("href")
|
||||||
|
assert.Equal(t, "/user2", ownerLinkHref)
|
||||||
|
|
||||||
|
t.Run("Ghost owner", func(t *testing.T) {
|
||||||
|
defer tests.PrintCurrentTest(t)()
|
||||||
|
|
||||||
|
ghost := user_model.NewGhostUser()
|
||||||
|
err = release.CreateNewTag(git.DefaultContext, ghost, repo, "master", "ghost-tag", "a spooky tag")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
req := NewRequestf(t, "GET", "/%s/releases/tag/ghost-tag", repo.FullName())
|
||||||
|
resp := MakeRequest(t, req, http.StatusOK)
|
||||||
|
|
||||||
|
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||||
|
|
||||||
|
// Test that the Ghost user does not link anywhere
|
||||||
|
ownerLink := htmlDoc.Find("a.author")
|
||||||
|
_, ok := ownerLink.Attr("href")
|
||||||
|
assert.Equal(t, 1, ownerLink.Length())
|
||||||
|
assert.False(t, ok)
|
||||||
|
assert.Equal(t, "Ghost", ownerLink.Text())
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCreateNewTagProtected(t *testing.T) {
|
func TestCreateNewTagProtected(t *testing.T) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue