Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2add8fe

Browse files
authoredOct 21, 2021
Frontend refactor, PascalCase to camelCase, remove unused code (#17365)
* Frontend refactor, PascalCase to camelCase, remove unused code * fix
1 parent 5879ab8 commit 2add8fe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+162
-182
lines changed
 

‎integrations/branches_test.go‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"net/url"
1010
"testing"
1111

12-
"github.com/PuerkitoBio/goquery"
1312
"github.com/stretchr/testify/assert"
1413
"github.com/unknwon/i18n"
1514
)
@@ -62,7 +61,7 @@ func branchAction(t *testing.T, button string) (*HTMLDoc, string) {
6261
}
6362

6463
req = NewRequestWithValues(t, "POST", link, map[string]string{
65-
"_csrf": getCsrf(t, htmlDoc.doc),
64+
"_csrf": htmlDoc.GetCSRF(),
6665
})
6766
session.MakeRequest(t, req, http.StatusOK)
6867

@@ -73,9 +72,3 @@ func branchAction(t *testing.T, button string) (*HTMLDoc, string) {
7372

7473
return NewHTMLParser(t, resp.Body), url.Query().Get("name")
7574
}
76-
77-
func getCsrf(t *testing.T, doc *goquery.Document) string {
78-
csrf, exists := doc.Find("meta[name=\"_csrf\"]").Attr("content")
79-
assert.True(t, exists)
80-
return csrf
81-
}

‎integrations/html_helper.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func (doc *HTMLDoc) Find(selector string) *goquery.Selection {
4444
return doc.doc.Find(selector)
4545
}
4646

47-
// GetCSRF for get CSRC token value from input
47+
// GetCSRF for getting CSRF token value from input
4848
func (doc *HTMLDoc) GetCSRF() string {
4949
return doc.GetInputValueByName("_csrf")
5050
}

‎integrations/pull_create_test.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ func testUIDeleteBranch(t *testing.T, session *TestSession, ownerName, repoName,
114114
htmlDoc := NewHTMLParser(t, resp.Body)
115115

116116
req = NewRequestWithValues(t, "POST", relURL+"/delete", map[string]string{
117-
"_csrf": getCsrf(t, htmlDoc.doc),
117+
"_csrf": htmlDoc.GetCSRF(),
118118
"name": branchName,
119119
})
120120
session.MakeRequest(t, req, http.StatusOK)
@@ -127,7 +127,7 @@ func testDeleteRepository(t *testing.T, session *TestSession, ownerName, repoNam
127127
htmlDoc := NewHTMLParser(t, resp.Body)
128128

129129
req = NewRequestWithValues(t, "POST", relURL+"?action=delete", map[string]string{
130-
"_csrf": getCsrf(t, htmlDoc.doc),
130+
"_csrf": htmlDoc.GetCSRF(),
131131
"repo_name": repoName,
132132
})
133133
session.MakeRequest(t, req, http.StatusFound)

‎modules/context/context.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ func Contexter() func(next http.Handler) http.Handler {
645645
"CurrentURL": setting.AppSubURL + req.URL.RequestURI(),
646646
"PageStartTime": startTime,
647647
"Link": link,
648-
"IsProd": setting.IsProd,
648+
"RunModeIsProd": setting.IsProd,
649649
},
650650
}
651651
// PageData is passed by reference, and it will be rendered to `window.config.pageData` in `head.tmpl` for JavaScript modules

0 commit comments

Comments
 (0)
Please sign in to comment.