Skip to content

Commit d68e0d3

Browse files
BeowulfR0ko
authored andcommitted
fix(ui): hide git note add button for commit if commit already has a note (go-gitea#6613)
Regression from f5c0570 Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6613 Reviewed-by: 0ko <[email protected]> Co-authored-by: Beowulf <[email protected]> Co-committed-by: Beowulf <[email protected]>
1 parent e35afe4 commit d68e0d3

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

templates/repo/commit_page.tmpl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,11 @@
128128
</form>
129129
</div>
130130
</div>
131-
<div id="commit-notes-add-button" class="item">
132-
{{ctx.Locale.Tr "repo.diff.git-notes.add"}}
133-
</div>
131+
{{if not .NoteRendered}}
132+
<div id="commit-notes-add-button" class="item">
133+
{{ctx.Locale.Tr "repo.diff.git-notes.add"}}
134+
</div>
135+
{{end}}
134136
</div>
135137
</div>
136138
{{end}}

tests/e2e/git-notes.test.e2e.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ test('Change git note', async ({page}) => {
88
let response = await page.goto('/user2/repo1/commit/65f1bf27bc3bf70f64657658635e66094edbcb4d');
99
expect(response?.status()).toBe(200);
1010

11+
// An add button should not be present, because the commit already has a commit note
12+
await expect(page.locator('#commit-notes-add-button')).toHaveCount(0);
13+
1114
await page.locator('#commit-notes-edit-button').click();
1215

1316
let textarea = page.locator('textarea[name="notes"]');

0 commit comments

Comments
 (0)