From 28db11f2e79b8d03e27a00b460d860034b9af9b4 Mon Sep 17 00:00:00 2001 From: forgejo-backport-action Date: Sat, 18 Jan 2025 19:43:08 +0000 Subject: [PATCH] [v10.0/forgejo] fix(ui): hide git note add button for commit if commit already has a note (#6614) Backport: https://codeberg.org/forgejo/forgejo/pulls/6613 Regression from f5c0570533b0a835a88eb7337da841d071f2de6b Co-authored-by: Beowulf Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6614 Reviewed-by: Beowulf Reviewed-by: 0ko <0ko@noreply.codeberg.org> Co-authored-by: forgejo-backport-action Co-committed-by: forgejo-backport-action --- templates/repo/commit_page.tmpl | 8 +++++--- tests/e2e/git-notes.test.e2e.ts | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/templates/repo/commit_page.tmpl b/templates/repo/commit_page.tmpl index 66be0c143d..36de789dd1 100644 --- a/templates/repo/commit_page.tmpl +++ b/templates/repo/commit_page.tmpl @@ -128,9 +128,11 @@ -
- {{ctx.Locale.Tr "repo.diff.git-notes.add"}} -
+ {{if not .NoteRendered}} +
+ {{ctx.Locale.Tr "repo.diff.git-notes.add"}} +
+ {{end}} {{end}} diff --git a/tests/e2e/git-notes.test.e2e.ts b/tests/e2e/git-notes.test.e2e.ts index 4245853b24..1e2cbe76fc 100644 --- a/tests/e2e/git-notes.test.e2e.ts +++ b/tests/e2e/git-notes.test.e2e.ts @@ -8,6 +8,9 @@ test('Change git note', async ({page}) => { let response = await page.goto('/user2/repo1/commit/65f1bf27bc3bf70f64657658635e66094edbcb4d'); expect(response?.status()).toBe(200); + // An add button should not be present, because the commit already has a commit note + await expect(page.locator('#commit-notes-add-button')).toHaveCount(0); + await page.locator('#commit-notes-edit-button').click(); let textarea = page.locator('textarea[name="notes"]');