feat: show CI status on force-pushes (#8655)

If a change is part of a force-push and the commit(s) have a CI status, this will now be shown after the hashes.

`interactiveBorder` has been lowered as it was possible to activate the hover state for both commits. It would be unreasonable to test this within Playwright and thus this needs to be manually tested. On a pull request page that contains a force-push you will notice:
a) the (de)activation area for force-pushes is now smaller, and;
b) it is not possible to activate the hover state/popup for both commits.

ExecuteTemplate function from @gusted
https://codeberg.org/forgejo/forgejo/pulls/5168
https://codeberg.org/forgejo/forgejo/pulls/2884

Close #4932

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8655
Reviewed-by: Otto <otto@codeberg.org>
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Co-authored-by: Squel <squeljur+git@gmail.com>
Co-committed-by: Squel <squeljur+git@gmail.com>
This commit is contained in:
Squel 2025-08-13 03:29:36 +02:00 committed by Gusted
commit 4abf9e9db4
7 changed files with 70 additions and 12 deletions

View file

@ -4,6 +4,7 @@
package integration
import (
"net/http"
"net/url"
"testing"
@ -17,6 +18,7 @@ import (
"forgejo.org/modules/test"
"forgejo.org/services/actions"
"forgejo.org/services/automerge"
"forgejo.org/tests"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@ -48,3 +50,14 @@ func TestActionsAutomerge(t *testing.T) {
},
)
}
func TestForcePushCommitStatus(t *testing.T) {
defer unittest.OverrideFixtures("tests/integration/fixtures/TestForcePushCommitStatus/")()
defer tests.PrepareTestEnv(t)()
req := NewRequest(t, "GET", "/user2/commitsonpr/pulls/1")
resp := MakeRequest(t, req, http.StatusOK)
htmlDoc := NewHTMLParser(t, resp.Body)
htmlDoc.AssertElement(t, ".forced-push [data-tippy='commit-statuses']:nth-of-type(3) svg.commit-status.octicon-dot-fill", true)
htmlDoc.AssertElement(t, ".forced-push [data-tippy='commit-statuses']:nth-of-type(5) svg.commit-status.octicon-check", true)
}