mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-21 09:24:23 +01:00
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6029 Reviewed-by: 0ko <0ko@noreply.codeberg.org>
This commit is contained in:
commit
1316f4d338
|
@ -278,9 +278,9 @@
|
|||
<strong>{{.NoteCommit.Author.Name}}</strong>
|
||||
{{end}}
|
||||
<span class="text grey" id="note-authored-time">{{DateUtils.TimeSince .NoteCommit.Author.When}}</span>
|
||||
{{if or ($.Permission.CanWrite $.UnitTypeCode) (not $.Repository.IsArchived) (not .IsDeleted)}}
|
||||
{{if and ($.Permission.CanWrite $.UnitTypeCode) (not $.Repository.IsArchived) (not .IsDeleted)}}
|
||||
<div class="ui right">
|
||||
<button id="commit-notes-edit-button" class="ui tiny primary button" data-modal="#delete-note-modal">{{ctx.Locale.Tr "edit"}}</button>
|
||||
<button id="commit-notes-edit-button" class="ui tiny primary button">{{ctx.Locale.Tr "edit"}}</button>
|
||||
<button class="ui tiny button red show-modal" data-modal="#delete-note-modal">{{ctx.Locale.Tr "remove"}}</button>
|
||||
</div>
|
||||
<div class="ui small modal" id="delete-note-modal">
|
||||
|
|
|
@ -5,6 +5,8 @@ import (
|
|||
"net/url"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/tests"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
|
@ -42,3 +44,29 @@ func TestRepoModifyGitNotes(t *testing.T) {
|
|||
})
|
||||
})
|
||||
}
|
||||
|
||||
func TestRepoGitNotesButtonsVisible(t *testing.T) {
|
||||
onGiteaRun(t, func(*testing.T, *url.URL) {
|
||||
t.Run("With Permission", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
|
||||
session := loginUser(t, "user2")
|
||||
|
||||
req := NewRequest(t, "GET", "/user2/repo1/commit/65f1bf27bc3bf70f64657658635e66094edbcb4d")
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
assert.Contains(t, resp.Body.String(), "id=\"commit-notes-edit-button\"")
|
||||
assert.Contains(t, resp.Body.String(), "data-modal=\"#delete-note-modal\"")
|
||||
})
|
||||
|
||||
t.Run("Without Permission", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
|
||||
req := NewRequest(t, "GET", "/user2/repo1/commit/65f1bf27bc3bf70f64657658635e66094edbcb4d")
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
assert.NotContains(t, resp.Body.String(), "id=\"commit-notes-edit-button\"")
|
||||
assert.NotContains(t, resp.Body.String(), "data-modal=\"#delete-note-modal\"")
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue