Skip to content

Commit fe778b8

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: (63 commits) Apply to become a maintainer (go-gitea#30151) Refactor markdown render (go-gitea#30139) Drag-and-drop improvements for projects and issue pins (go-gitea#29875) Fix table alignment classes (go-gitea#30144) Add default board to new projects, remove uncategorized pseudo-board (go-gitea#29874) Fix loading spinner on ContextPopup (go-gitea#30145) Fix download buttons on branches page (go-gitea#30147) Relax generic package filename restrictions (go-gitea#30135) Remove jQuery class from the common admin functions (go-gitea#30137) Remove jQuery class from the reaction selector (go-gitea#30138) Forbid jQuery `.attr` (go-gitea#30116) Refactor render (go-gitea#30136) Fix: Organization Interface Display Issue (go-gitea#30133) Remove jQuery `.attr` from the Fomantic dropdowns (go-gitea#30114) Remove jQuery `.attr` from the common admin functions (go-gitea#30115) Remove jQuery from the create/rename branch modals (except Fomantic) (go-gitea#30109) Remove fomantic label module (go-gitea#30081) Fix bug for markdown rendering of blockquote (go-gitea#30130) Fix: The interface is broken when modifying code comments under mobile devices (go-gitea#30125) When the title in the issue has a value, set the text cursor at the end of the text. (go-gitea#30090) ... # Conflicts: # templates/user/dashboard/issues.tmpl
2 parents 251d2f2 + 7ba485b commit fe778b8

File tree

334 files changed

+7683
-10286
lines changed

Some content is hidden

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

334 files changed

+7683
-10286
lines changed

.eslintrc.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ rules:
167167
"@stylistic/js/semi-spacing": [2, {before: false, after: true}]
168168
"@stylistic/js/semi-style": [2, last]
169169
"@stylistic/js/space-before-blocks": [2, always]
170-
"@stylistic/js/space-before-function-paren": [0]
170+
"@stylistic/js/space-before-function-paren": [2, {anonymous: ignore, named: never, asyncArrow: always}]
171171
"@stylistic/js/space-in-parens": [2, never]
172172
"@stylistic/js/space-infix-ops": [2]
173173
"@stylistic/js/space-unary-ops": [2]
@@ -281,7 +281,7 @@ rules:
281281
jquery/no-ajax-events: [2]
282282
jquery/no-ajax: [2]
283283
jquery/no-animate: [2]
284-
jquery/no-attr: [0]
284+
jquery/no-attr: [2]
285285
jquery/no-bind: [2]
286286
jquery/no-class: [0]
287287
jquery/no-clone: [2]
@@ -303,7 +303,7 @@ rules:
303303
jquery/no-in-array: [2]
304304
jquery/no-is-array: [2]
305305
jquery/no-is-function: [2]
306-
jquery/no-is: [0]
306+
jquery/no-is: [2]
307307
jquery/no-load: [2]
308308
jquery/no-map: [2]
309309
jquery/no-merge: [2]
@@ -397,7 +397,7 @@ rules:
397397
no-jquery/no-animate-toggle: [2]
398398
no-jquery/no-animate: [2]
399399
no-jquery/no-append-html: [2]
400-
no-jquery/no-attr: [0]
400+
no-jquery/no-attr: [2]
401401
no-jquery/no-bind: [2]
402402
no-jquery/no-box-model: [2]
403403
no-jquery/no-browser: [2]
@@ -440,7 +440,7 @@ rules:
440440
no-jquery/no-is-numeric: [2]
441441
no-jquery/no-is-plain-object: [2]
442442
no-jquery/no-is-window: [2]
443-
no-jquery/no-is: [0]
443+
no-jquery/no-is: [2]
444444
no-jquery/no-jquery-constructor: [0]
445445
no-jquery/no-live: [2]
446446
no-jquery/no-load-shorthand: [2]

.github/workflows/files-changed.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ jobs:
7373
- "Makefile"
7474
7575
templates:
76+
- "tools/lint-templates-*.js"
7677
- "templates/**/*.tmpl"
7778
- "pyproject.toml"
7879
- "poetry.lock"

.github/workflows/pull-compliance.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,12 @@ jobs:
3535
- uses: actions/setup-python@v5
3636
with:
3737
python-version: "3.12"
38+
- uses: actions/setup-node@v4
39+
with:
40+
node-version: 20
3841
- run: pip install poetry
3942
- run: make deps-py
43+
- run: make deps-frontend
4044
- run: make lint-templates
4145

4246
lint-yaml:

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,4 @@ Nanguan Lin <[email protected]> (@lng2020)
6060
kerwin612 <[email protected]> (@kerwin612)
6161
Gary Wang <[email protected]> (@BLumia)
6262
Tim-Niclas Oelschläger <[email protected]> (@zokkis)
63+
Yu Liu <[email protected]> (@HEREYUA)

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,8 @@ lint-actions:
434434
$(GO) run $(ACTIONLINT_PACKAGE)
435435

436436
.PHONY: lint-templates
437-
lint-templates: .venv
437+
lint-templates: .venv node_modules
438+
@node tools/lint-templates-svg.js
438439
@poetry run djlint $(shell find templates -type f -iname '*.tmpl')
439440

440441
.PHONY: lint-yaml
@@ -958,7 +959,7 @@ generate-gitignore:
958959

959960
.PHONY: generate-images
960961
generate-images: | node_modules
961-
npm install --no-save [email protected]beta19 imagemin-zopfli@7
962+
npm install --no-save [email protected]beta20 imagemin-zopfli@7
962963
node tools/generate-images.js $(TAGS)
963964

964965
.PHONY: generate-manpage

docs/content/administration/repo-indexer.en-us.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ menu:
1717

1818
# Repository indexer
1919

20+
## Builtin repository code search without indexer
21+
22+
Users could do repository-level code search without setting up a repository indexer.
23+
The builtin code search is based on the `git grep` command, which is fast and efficient for small repositories.
24+
Better code search support could be achieved by setting up the repository indexer.
25+
2026
## Setting up the repository indexer
2127

2228
Gitea can search through the files of the repositories by enabling this function in your [`app.ini`](administration/config-cheat-sheet.md):

docs/content/contributing/guidelines-frontend.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ However, there are still some special cases, so the current guideline is:
118118
### Show/Hide Elements
119119

120120
* Vue components are recommended to use `v-if` and `v-show` to show/hide elements.
121-
* Go template code should use Gitea's `.gt-hidden` and `showElem()/hideElem()/toggleElem()`, see more details in `.gt-hidden`'s comment.
121+
* Go template code should use `.tw-hidden` and `showElem()/hideElem()/toggleElem()`, see more details in `.tw-hidden`'s comment.
122122

123123
### Styles and Attributes in Go HTML Template
124124

docs/content/contributing/guidelines-frontend.zh-cn.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ Gitea 使用一些补丁使 Fomantic UI 更具可访问性(参见 `aria.md`)
117117
### 显示/隐藏元素
118118

119119
* 推荐在Vue组件中使用`v-if``v-show`来显示/隐藏元素。
120-
* Go 模板代码应使用 Gitea 的 `.gt-hidden``showElem()/hideElem()/toggleElem()` 来显示/隐藏元素,请参阅`.gt-hidden`的注释以获取更多详细信息。
120+
* Go 模板代码应使用 `.tw-hidden``showElem()/hideElem()/toggleElem()` 来显示/隐藏元素,请参阅`.tw-hidden`的注释以获取更多详细信息。
121121

122122
### Go HTML 模板中的样式和属性
123123

docs/content/installation/comparison.en-us.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ _Symbols used in table:_
8787
| Git Blame |||||||||
8888
| Visual comparison of image changes |||| ? | ? | ? |||
8989

90+
- Gitea has builtin repository-level code search
91+
- Better code search support could be achieved by [using a repository indexer](administration/repo-indexer.md)
92+
9093
## Issue Tracker
9194

9295
| Feature | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE | RhodeCode EE |

models/db/context.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,16 @@ func (c *halfCommitter) Close() error {
120120

121121
// TxContext represents a transaction Context,
122122
// it will reuse the existing transaction in the parent context or create a new one.
123+
// Some tips to use:
124+
//
125+
// 1 It's always recommended to use `WithTx` in new code instead of `TxContext`, since `WithTx` will handle the transaction automatically.
126+
// 2. To maintain the old code which uses `TxContext`:
127+
// a. Always call `Close()` before returning regardless of whether `Commit()` has been called.
128+
// b. Always call `Commit()` before returning if there are no errors, even if the code did not change any data.
129+
// c. Remember the `Committer` will be a halfCommitter when a transaction is being reused.
130+
// So calling `Commit()` will do nothing, but calling `Close()` without calling `Commit()` will rollback the transaction.
131+
// And all operations submitted by the caller stack will be rollbacked as well, not only the operations in the current function.
132+
// d. It doesn't mean rollback is forbidden, but always do it only when there is an error, and you do want to rollback.
123133
func TxContext(parentCtx context.Context) (*Context, Committer, error) {
124134
if sess, ok := inTransaction(parentCtx); ok {
125135
return newContext(parentCtx, sess, true), &halfCommitter{committer: sess}, nil

models/fixtures/project.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,27 @@
4545
type: 2
4646
created_unix: 1688973000
4747
updated_unix: 1688973000
48+
49+
-
50+
id: 5
51+
title: project without default column
52+
owner_id: 2
53+
repo_id: 0
54+
is_closed: false
55+
creator_id: 2
56+
board_type: 1
57+
type: 2
58+
created_unix: 1688973000
59+
updated_unix: 1688973000
60+
61+
-
62+
id: 6
63+
title: project with multiple default columns
64+
owner_id: 2
65+
repo_id: 0
66+
is_closed: false
67+
creator_id: 2
68+
board_type: 1
69+
type: 2
70+
created_unix: 1688973000
71+
updated_unix: 1688973000

models/fixtures/project_board.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
project_id: 1
44
title: To Do
55
creator_id: 2
6+
default: true
67
created_unix: 1588117528
78
updated_unix: 1588117528
89

@@ -29,3 +30,48 @@
2930
creator_id: 2
3031
created_unix: 1588117528
3132
updated_unix: 1588117528
33+
34+
-
35+
id: 5
36+
project_id: 2
37+
title: Backlog
38+
creator_id: 2
39+
default: true
40+
created_unix: 1588117528
41+
updated_unix: 1588117528
42+
43+
-
44+
id: 6
45+
project_id: 4
46+
title: Backlog
47+
creator_id: 2
48+
default: true
49+
created_unix: 1588117528
50+
updated_unix: 1588117528
51+
52+
-
53+
id: 7
54+
project_id: 5
55+
title: Done
56+
creator_id: 2
57+
default: false
58+
created_unix: 1588117528
59+
updated_unix: 1588117528
60+
61+
-
62+
id: 8
63+
project_id: 6
64+
title: Backlog
65+
creator_id: 2
66+
default: true
67+
created_unix: 1588117528
68+
updated_unix: 1588117528
69+
70+
-
71+
id: 9
72+
project_id: 6
73+
title: Uncategorized
74+
creator_id: 2
75+
default: true
76+
created_unix: 1588117528
77+
updated_unix: 1588117528

models/issues/comment_code.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ func findCodeComments(ctx context.Context, opts FindCommentsOptions, issue *Issu
7474
return nil, err
7575
}
7676

77+
if err := comments.LoadAttachments(ctx); err != nil {
78+
return nil, err
79+
}
80+
7781
// Find all reviews by ReviewID
7882
reviews := make(map[int64]*Review)
7983
ids := make([]int64, 0, len(comments))

models/issues/issue_project.go

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,13 @@ func (issue *Issue) ProjectBoardID(ctx context.Context) int64 {
4949

5050
// LoadIssuesFromBoard load issues assigned to this board
5151
func LoadIssuesFromBoard(ctx context.Context, b *project_model.Board) (IssueList, error) {
52-
issueList := make(IssueList, 0, 10)
53-
54-
if b.ID > 0 {
55-
issues, err := Issues(ctx, &IssuesOptions{
56-
ProjectBoardID: b.ID,
57-
ProjectID: b.ProjectID,
58-
SortType: "project-column-sorting",
59-
})
60-
if err != nil {
61-
return nil, err
62-
}
63-
issueList = issues
52+
issueList, err := Issues(ctx, &IssuesOptions{
53+
ProjectBoardID: b.ID,
54+
ProjectID: b.ProjectID,
55+
SortType: "project-column-sorting",
56+
})
57+
if err != nil {
58+
return nil, err
6459
}
6560

6661
if b.Default {

models/issues/issue_search.go

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121

2222
// IssuesOptions represents options of an issue.
2323
type IssuesOptions struct { //nolint
24-
db.Paginator
24+
Paginator *db.ListOptions
2525
RepoIDs []int64 // overwrites RepoCond if the length is not 0
2626
RepoCond builder.Cond
2727
AssigneeID int64
@@ -103,23 +103,11 @@ func applyLimit(sess *xorm.Session, opts *IssuesOptions) *xorm.Session {
103103
return sess
104104
}
105105

106-
// Warning: Do not use GetSkipTake() for *db.ListOptions
107-
// Its implementation could reset the page size with setting.API.MaxResponseItems
108-
if listOptions, ok := opts.Paginator.(*db.ListOptions); ok {
109-
if listOptions.Page >= 0 && listOptions.PageSize > 0 {
110-
var start int
111-
if listOptions.Page == 0 {
112-
start = 0
113-
} else {
114-
start = (listOptions.Page - 1) * listOptions.PageSize
115-
}
116-
sess.Limit(listOptions.PageSize, start)
117-
}
118-
return sess
106+
start := 0
107+
if opts.Paginator.Page > 1 {
108+
start = (opts.Paginator.Page - 1) * opts.Paginator.PageSize
119109
}
120-
121-
start, limit := opts.Paginator.GetSkipTake()
122-
sess.Limit(limit, start)
110+
sess.Limit(opts.Paginator.PageSize, start)
123111

124112
return sess
125113
}

models/issues/issue_stats.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,17 @@ func CountIssuesByRepo(ctx context.Context, opts *IssuesOptions) (map[int64]int6
6868
}
6969

7070
// CountIssues number return of issues by given conditions.
71-
func CountIssues(ctx context.Context, opts *IssuesOptions) (int64, error) {
71+
func CountIssues(ctx context.Context, opts *IssuesOptions, otherConds ...builder.Cond) (int64, error) {
7272
sess := db.GetEngine(ctx).
7373
Select("COUNT(issue.id) AS count").
7474
Table("issue").
7575
Join("INNER", "repository", "`issue`.repo_id = `repository`.id")
7676
applyConditions(sess, opts)
7777

78+
for _, cond := range otherConds {
79+
sess.And(cond)
80+
}
81+
7882
return sess.Count()
7983
}
8084

models/issues/review.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ func AddReviewRequest(ctx context.Context, issue *Issue, reviewer, doer *user_mo
620620

621621
// skip it when reviewer hase been request to review
622622
if review != nil && review.Type == ReviewTypeRequest {
623-
return nil, nil
623+
return nil, committer.Commit() // still commit the transaction, or committer.Close() will rollback it, even if it's a reused transaction.
624624
}
625625

626626
// if the reviewer is an official reviewer,
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
-
2+
id: 1
3+
title: project without default column
4+
owner_id: 2
5+
repo_id: 0
6+
is_closed: false
7+
creator_id: 2
8+
board_type: 1
9+
type: 2
10+
created_unix: 1688973000
11+
updated_unix: 1688973000
12+
13+
-
14+
id: 2
15+
title: project with multiple default columns
16+
owner_id: 2
17+
repo_id: 0
18+
is_closed: false
19+
creator_id: 2
20+
board_type: 1
21+
type: 2
22+
created_unix: 1688973000
23+
updated_unix: 1688973000
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
-
2+
id: 1
3+
project_id: 1
4+
title: Done
5+
creator_id: 2
6+
default: false
7+
created_unix: 1588117528
8+
updated_unix: 1588117528
9+
10+
-
11+
id: 2
12+
project_id: 2
13+
title: Backlog
14+
creator_id: 2
15+
default: true
16+
created_unix: 1588117528
17+
updated_unix: 1588117528
18+
19+
-
20+
id: 3
21+
project_id: 2
22+
title: Uncategorized
23+
creator_id: 2
24+
default: true
25+
created_unix: 1588117528
26+
updated_unix: 1588117528

models/migrations/migrations.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,8 @@ var migrations = []Migration{
568568
NewMigration("Add PayloadVersion to HookTask", v1_22.AddPayloadVersionToHookTaskTable),
569569
// v291 -> v292
570570
NewMigration("Add Index to attachment.comment_id", v1_22.AddCommentIDIndexofAttachment),
571+
// v292 -> v293
572+
NewMigration("Ensure every project has exactly one default column", v1_22.CheckProjectColumnsConsistency),
571573
}
572574

573575
// GetCurrentDBVersion returns the current db version

0 commit comments

Comments
 (0)