Fix wrong display of recently pushed notification (#25812) (#31043)

Backport #25812

~~ps: removed some new codes in `tests/integration/pull_merge_test.go`~~

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
yp05327 2024-05-23 13:14:26 +09:00 committed by GitHub
parent 14ed06d675
commit 564fef1e20
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 508 additions and 72 deletions

View file

@ -6,9 +6,11 @@ package integration
import (
"bytes"
"encoding/base64"
"fmt"
"io"
"mime/multipart"
"net/http"
"net/http/httptest"
"testing"
auth_model "code.gitea.io/gitea/models/auth"
@ -24,6 +26,17 @@ import (
"github.com/stretchr/testify/assert"
)
func testAPINewFile(t *testing.T, session *TestSession, user, repo, branch, treePath, content string) *httptest.ResponseRecorder {
url := fmt.Sprintf("/%s/%s/_new/%s", user, repo, branch)
req := NewRequestWithValues(t, "POST", url, map[string]string{
"_csrf": GetCSRF(t, session, "/user/settings"),
"commit_choice": "direct",
"tree_path": treePath,
"content": content,
})
return session.MakeRequest(t, req, http.StatusSeeOther)
}
func TestEmptyRepo(t *testing.T) {
defer tests.PrepareTestEnv(t)()
subPaths := []string{