Skip to content

Commit cf686e1

Browse files
committed
Merge branch 'main' into crowdin-action
2 parents f36db88 + 849eee8 commit cf686e1

File tree

183 files changed

+11889
-12493
lines changed

Some content is hidden

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

183 files changed

+11889
-12493
lines changed

.dockerignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ _test
1414

1515
# MS VSCode
1616
.vscode
17-
__debug_bin
17+
__debug_bin*
1818

1919
# Architecture specific extensions/prefixes
2020
*.[568vq]
@@ -78,7 +78,6 @@ cpu.out
7878
/public/assets/css
7979
/public/assets/fonts
8080
/public/assets/img/avatar
81-
/public/assets/img/webpack
8281
/vendor
8382
/web_src/fomantic/node_modules
8483
/web_src/fomantic/build/*

.eslintrc.yaml

Lines changed: 3 additions & 3 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]
@@ -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]

.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:

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ cpu.out
7777
/public/assets/css
7878
/public/assets/fonts
7979
/public/assets/licenses.txt
80-
/public/assets/img/webpack
8180
/vendor
8281
/web_src/fomantic/node_modules
8382
/web_src/fomantic/build/*

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: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ FOMANTIC_WORK_DIR := web_src/fomantic
119119
WEBPACK_SOURCES := $(shell find web_src/js web_src/css -type f)
120120
WEBPACK_CONFIGS := webpack.config.js tailwind.config.js
121121
WEBPACK_DEST := public/assets/js/index.js public/assets/css/index.css
122-
WEBPACK_DEST_ENTRIES := public/assets/js public/assets/css public/assets/fonts public/assets/img/webpack
122+
WEBPACK_DEST_ENTRIES := public/assets/js public/assets/css public/assets/fonts
123123

124124
BINDATA_DEST := modules/public/bindata.go modules/options/bindata.go modules/templates/bindata.go
125125
BINDATA_HASH := $(addsuffix .hash,$(BINDATA_DEST))
@@ -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

custom/conf/app.example.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ INTERNAL_TOKEN =
441441
;INTERNAL_TOKEN_URI = file:/etc/gitea/internal_token
442442
;;
443443
;; How long to remember that a user is logged in before requiring relogin (in days)
444-
;LOGIN_REMEMBER_DAYS = 7
444+
;LOGIN_REMEMBER_DAYS = 31
445445
;;
446446
;; Name of the cookie used to store the current username.
447447
;COOKIE_USERNAME = gitea_awesome

docs/content/administration/config-cheat-sheet.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ And the following unique queues:
528528
- `INSTALL_LOCK`: **false**: Controls access to the installation page. When set to "true", the installation page is not accessible.
529529
- `SECRET_KEY`: **\<random at every install\>**: Global secret key. This key is VERY IMPORTANT, if you lost it, the data encrypted by it (like 2FA secret) can't be decrypted anymore.
530530
- `SECRET_KEY_URI`: **_empty_**: Instead of defining SECRET_KEY, this option can be used to use the key stored in a file (example value: `file:/etc/gitea/secret_key`). It shouldn't be lost like SECRET_KEY.
531-
- `LOGIN_REMEMBER_DAYS`: **7**: Cookie lifetime, in days.
531+
- `LOGIN_REMEMBER_DAYS`: **31**: How long to remember that a user is logged in before requiring relogin (in days).
532532
- `COOKIE_REMEMBER_NAME`: **gitea\_incredible**: Name of cookie used to store authentication
533533
information.
534534
- `REVERSE_PROXY_AUTHENTICATION_USER`: **X-WEBAUTH-USER**: Header name for reverse proxy

docs/content/administration/config-cheat-sheet.zh-cn.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ Gitea 创建以下非唯一队列:
507507
- `INSTALL_LOCK`: **false**:控制是否能够访问安装向导页面,设置为 `true` 则禁止访问安装向导页面。
508508
- `SECRET_KEY`: **\<每次安装时随机生成\>**:全局服务器安全密钥。这个密钥非常重要,如果丢失将无法解密加密的数据(例如 2FA)。
509509
- `SECRET_KEY_URI`: **_empty_**:与定义 `SECRET_KEY` 不同,此选项可用于使用存储在文件中的密钥(示例值:`file:/etc/gitea/secret_key`)。它不应该像 `SECRET_KEY` 一样容易丢失。
510-
- `LOGIN_REMEMBER_DAYS`: **7**Cookie 保存时间,单位为天
510+
- `LOGIN_REMEMBER_DAYS`: **31**在要求重新登录之前,记住用户的登录状态多长时间(以天为单位)
511511
- `COOKIE_REMEMBER_NAME`: **gitea\_incredible**:保存自动登录信息的 Cookie 名称。
512512
- `REVERSE_PROXY_AUTHENTICATION_USER`: **X-WEBAUTH-USER**:反向代理认证的 HTTP 头部名称,用于提供用户信息。
513513
- `REVERSE_PROXY_AUTHENTICATION_EMAIL`: **X-WEBAUTH-EMAIL**:反向代理认证的 HTTP 头部名称,用于提供邮箱信息。

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ We recommend [Google HTML/CSS Style Guide](https://google.github.io/styleguide/h
4747
9. Avoid unnecessary `!important` in CSS, add comments to explain why it's necessary if it can't be avoided.
4848
10. Avoid mixing different events in one event listener, prefer to use individual event listeners for every event.
4949
11. Custom event names are recommended to use `ce-` prefix.
50-
12. Prefer using Tailwind CSS which is available via `tw-` prefix, e.g. `tw-relative`. Gitea's helper CSS classes use `gt-` prefix (`gt-mono`), while Gitea's own private framework-level CSS classes use `g-` prefix (`g-modal-confirm`).
50+
12. Prefer using Tailwind CSS which is available via `tw-` prefix, e.g. `tw-relative`. Gitea's helper CSS classes use `gt-` prefix (`gt-word-break`), while Gitea's own private framework-level CSS classes use `g-` prefix (`g-modal-confirm`).
5151
13. Avoid inline scripts & styles as much as possible, it's recommended to put JS code into JS files and use CSS classes. If inline scripts & styles are unavoidable, explain the reason why it can't be avoided.
5252

5353
### Accessibility / ARIA

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ HTML 页面由[Go HTML Template](https://pkg.go.dev/html/template)渲染。
4747
9. 避免在 CSS 中使用不必要的`!important`,如果无法避免,添加注释解释为什么需要它。
4848
10. 避免在一个事件监听器中混合不同的事件,优先为每个事件使用独立的事件监听器。
4949
11. 推荐使用自定义事件名称前缀`ce-`
50-
12. 建议使用 Tailwind CSS,它可以通过 `tw-` 前缀获得,例如 `tw-relative`. Gitea 自身的助手类 CSS 使用 `gt-` 前缀(`gt-mono`),Gitea 自身的私有框架级 CSS 类使用 `g-` 前缀(`g-modal-confirm`)。
50+
12. 建议使用 Tailwind CSS,它可以通过 `tw-` 前缀获得,例如 `tw-relative`. Gitea 自身的助手类 CSS 使用 `gt-` 前缀(`gt-word-break`),Gitea 自身的私有框架级 CSS 类使用 `g-` 前缀(`g-modal-confirm`)。
5151
13. 尽量避免内联脚本和样式,建议将JS代码放入JS文件中并使用CSS类。如果内联脚本和样式不可避免,请解释无法避免的原因。
5252

5353
### 可访问性 / ARIA

models/actions/variable.go

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@ package actions
66
import (
77
"context"
88
"errors"
9-
"fmt"
109
"strings"
1110

1211
"code.gitea.io/gitea/models/db"
1312
"code.gitea.io/gitea/modules/log"
1413
"code.gitea.io/gitea/modules/timeutil"
15-
"code.gitea.io/gitea/modules/util"
1614

1715
"xorm.io/builder"
1816
)
@@ -55,24 +53,24 @@ type FindVariablesOpts struct {
5553
db.ListOptions
5654
OwnerID int64
5755
RepoID int64
56+
Name string
5857
}
5958

6059
func (opts FindVariablesOpts) ToConds() builder.Cond {
6160
cond := builder.NewCond()
61+
// Since we now support instance-level variables,
62+
// there is no need to check for null values for `owner_id` and `repo_id`
6263
cond = cond.And(builder.Eq{"owner_id": opts.OwnerID})
6364
cond = cond.And(builder.Eq{"repo_id": opts.RepoID})
65+
66+
if opts.Name != "" {
67+
cond = cond.And(builder.Eq{"name": strings.ToUpper(opts.Name)})
68+
}
6469
return cond
6570
}
6671

67-
func GetVariableByID(ctx context.Context, variableID int64) (*ActionVariable, error) {
68-
var variable ActionVariable
69-
has, err := db.GetEngine(ctx).Where("id=?", variableID).Get(&variable)
70-
if err != nil {
71-
return nil, err
72-
} else if !has {
73-
return nil, fmt.Errorf("variable with id %d: %w", variableID, util.ErrNotExist)
74-
}
75-
return &variable, nil
72+
func FindVariables(ctx context.Context, opts FindVariablesOpts) ([]*ActionVariable, error) {
73+
return db.Find[ActionVariable](ctx, opts)
7674
}
7775

7876
func UpdateVariable(ctx context.Context, variable *ActionVariable) (bool, error) {
@@ -84,6 +82,13 @@ func UpdateVariable(ctx context.Context, variable *ActionVariable) (bool, error)
8482
return count != 0, err
8583
}
8684

85+
func DeleteVariable(ctx context.Context, id int64) error {
86+
if _, err := db.DeleteByID[ActionVariable](ctx, id); err != nil {
87+
return err
88+
}
89+
return nil
90+
}
91+
8792
func GetVariablesOfRun(ctx context.Context, run *ActionRun) (map[string]string, error) {
8893
variables := map[string]string{}
8994

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

0 commit comments

Comments
 (0)