Skip to content

Commit cb700ae

Browse files
authored
Split "modules/context.go" to separate files (#24569)
The "modules/context.go" is too large to maintain. This PR splits it to separate files, eg: context_request.go, context_response.go, context_serve.go This PR will help: 1. The future refactoring for Gitea's web context (eg: simplify the context) 2. Introduce proper "range request" support 3. Introduce context function This PR only moves code, doesn't change any logic.
1 parent ff56292 commit cb700ae

18 files changed

+747
-676
lines changed

models/repo.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ import (
3535
"xorm.io/builder"
3636
)
3737

38-
// ItemsPerPage maximum items per page in forks, watchers and stars of a repo
39-
var ItemsPerPage = 40
40-
4138
// Init initialize model
4239
func Init(ctx context.Context) error {
4340
if err := unit.LoadUnitConfig(); err != nil {

models/repo/search.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2023 The Gitea Authors. All rights reserved.
2+
// SPDX-License-Identifier: MIT
3+
4+
package repo
5+
6+
import "code.gitea.io/gitea/models/db"
7+
8+
// SearchOrderByMap represents all possible search order
9+
var SearchOrderByMap = map[string]map[string]db.SearchOrderBy{
10+
"asc": {
11+
"alpha": db.SearchOrderByAlphabetically,
12+
"created": db.SearchOrderByOldest,
13+
"updated": db.SearchOrderByLeastUpdated,
14+
"size": db.SearchOrderBySize,
15+
"id": db.SearchOrderByID,
16+
},
17+
"desc": {
18+
"alpha": db.SearchOrderByAlphabeticallyReverse,
19+
"created": db.SearchOrderByNewest,
20+
"updated": db.SearchOrderByRecentUpdated,
21+
"size": db.SearchOrderBySizeReverse,
22+
"id": db.SearchOrderByIDReverse,
23+
},
24+
}

0 commit comments

Comments
 (0)