mirror of
https://github.com/go-gitea/gitea.git
synced 2026-05-19 20:35:11 +02:00
fix maybeGroupSegment func, run formatter
This commit is contained in:
parent
d36d700ee8
commit
32e8a6dfd4
@ -122,7 +122,7 @@ func testEditorActionEdit(t *testing.T, session *TestSession, groupID int64, use
|
|||||||
params["tree_path"] = util.IfZero(params["tree_path"], filePath)
|
params["tree_path"] = util.IfZero(params["tree_path"], filePath)
|
||||||
newBranchName := util.Iif(params["commit_choice"] == "direct", branch, params["new_branch_name"])
|
newBranchName := util.Iif(params["commit_choice"] == "direct", branch, params["new_branch_name"])
|
||||||
|
|
||||||
resp := testEditorActionPostRequest(t, session, fmt.Sprintf("/%s/%s/%s%s/%s/%s", user, maybeWebGroupSegment(groupID), repo, editorAction, branch, filePath), params)
|
resp := testEditorActionPostRequest(t, session, fmt.Sprintf("/%s/%s/%s%s/%s/%s", user, maybeGroupSegment(groupID), repo, editorAction, branch, filePath), params)
|
||||||
assert.Equal(t, http.StatusOK, resp.Code)
|
assert.Equal(t, http.StatusOK, resp.Code)
|
||||||
assert.NotEmpty(t, test.RedirectURL(resp))
|
assert.NotEmpty(t, test.RedirectURL(resp))
|
||||||
req := NewRequest(t, "GET", path.Join(user, repo, "raw/branch", newBranchName, params["tree_path"]))
|
req := NewRequest(t, "GET", path.Join(user, repo, "raw/branch", newBranchName, params["tree_path"]))
|
||||||
|
|||||||
@ -7,15 +7,7 @@ import "fmt"
|
|||||||
|
|
||||||
func maybeGroupSegment(gid int64) string {
|
func maybeGroupSegment(gid int64) string {
|
||||||
if gid > 0 {
|
if gid > 0 {
|
||||||
return fmt.Sprintf("%d/", gid)
|
return fmt.Sprintf("group/%d/", gid)
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func maybeWebGroupSegment(gid int64) string {
|
|
||||||
gs := maybeGroupSegment(gid)
|
|
||||||
if gs != "" {
|
|
||||||
return "group/" + gs
|
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user