Skip to content

Commit d507440

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: Enable two vue eslint rules (go-gitea#24780) Add two eslint plugins (go-gitea#24776) Mark `models/fixtures` as generated (go-gitea#24775) Fix TestMinioStorageIterator skip message (go-gitea#24765) Fix missed table name on iterate lfs meta objects (go-gitea#24768) Revert "Fix missed table name on iterate lfs meta objects" (go-gitea#24764) Make the color of zero-contribution-squares in the activity heatmap more subtle (go-gitea#24758) Fix missed table name on iterate lfs meta objects Skip TestMinioStorageIterator on CI (go-gitea#24762) Support no label/assignee filter and batch clearing labels/assignees (go-gitea#24707) Support for status check pattern (go-gitea#24633) Updates to doc (go-gitea#24757) Ignore build for docs only (go-gitea#24761) Fix team members API endpoint pagination (go-gitea#24754) Make mailer SMTP check have timed context (go-gitea#24751) Add @garymoon to MAINTAINERS (go-gitea#24752) Skip TestRepoCommitsStatusParallel on CI (go-gitea#24741) Respect original content when creating secrets (go-gitea#24745)
2 parents d10f090 + 040970c commit d507440

File tree

33 files changed

+505
-117
lines changed

33 files changed

+505
-117
lines changed

.eslintrc.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ parserOptions:
1010

1111
plugins:
1212
- "@eslint-community/eslint-plugin-eslint-comments"
13+
- eslint-plugin-array-func
1314
- eslint-plugin-custom-elements
1415
- eslint-plugin-import
1516
- eslint-plugin-jquery
1617
- eslint-plugin-no-jquery
18+
- eslint-plugin-no-use-extend-native
1719
- eslint-plugin-regexp
1820
- eslint-plugin-sonarjs
1921
- eslint-plugin-unicorn
@@ -59,6 +61,12 @@ rules:
5961
array-bracket-spacing: [2, never]
6062
array-callback-return: [2, {checkForEach: true}]
6163
array-element-newline: [0]
64+
array-func/avoid-reverse: [2]
65+
array-func/from-map: [2]
66+
array-func/no-unnecessary-this-arg: [2]
67+
array-func/prefer-array-from: [2]
68+
array-func/prefer-flat-map: [0] # handled by unicorn/prefer-array-flat-map
69+
array-func/prefer-flat: [0] # handled by unicorn/prefer-array-flat
6270
arrow-body-style: [0]
6371
arrow-parens: [2, always]
6472
arrow-spacing: [2, {before: true, after: true}]
@@ -444,6 +452,7 @@ rules:
444452
no-unused-private-class-members: [2]
445453
no-unused-vars: [2, {args: all, argsIgnorePattern: ^_, varsIgnorePattern: ^_, caughtErrorsIgnorePattern: ^_, destructuredArrayIgnorePattern: ^_, ignoreRestSiblings: false}]
446454
no-use-before-define: [2, {functions: false, classes: true, variables: true, allowNamedExports: true}]
455+
no-use-extend-native/no-use-extend-native: [2]
447456
no-useless-backreference: [2]
448457
no-useless-call: [2]
449458
no-useless-catch: [2]

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
* text=auto eol=lf
22
*.tmpl linguist-language=Handlebars
33
/assets/*.json linguist-generated
4+
/models/fixtures/** linguist-generated
45
/public/img/svg/*.svg linguist-generated
56
/public/vendor/** -text -eol linguist-vendored
67
/templates/swagger/v1_json.tmpl linguist-generated

.github/workflows/pull-compliance-docsignore.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,33 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- run: echo "No build required"
14+
15+
lint-backend:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- run: echo "No build required"
19+
20+
lint-go-windows:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- run: echo "No build required"
24+
25+
lint-go-gogit:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- run: echo "No build required"
29+
30+
checks-backend:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- run: echo "No build required"
34+
35+
frontend:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- run: echo "No build required"
39+
40+
backend:
41+
runs-on: ubuntu-latest
42+
steps:
43+
- run: echo "No build required"

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,4 @@ Eddie Yang <[email protected]> (@yp05327)
5050
Dong Ge <[email protected]> (@sillyguodong)
5151
Xinyi Gong <[email protected]> (@HesterG)
5252
wxiaoguang <[email protected]> (@wxiaoguang)
53+
Gary Moon <[email protected]> (@garymoon)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ The following configuration set `Content-Type: application/vnd.android.package-a
220220
- `SHOW_USER_EMAIL`: **true**: Whether the email of the user should be shown in the Explore Users page.
221221
- `THEMES`: **auto,gitea,arc-green**: All available themes. Allow users select personalized themes.
222222
regardless of the value of `DEFAULT_THEME`.
223-
- `THEME_COLOR_META_TAG`: **\<empty\>**: Value of `theme-color` meta tag, used by some mobile browers for chrome and out-of-viewport areas. Default is unset which uses body color.
223+
- `THEME_COLOR_META_TAG`: **\<empty\>**: Value of `theme-color` meta tag, used by some mobile browsers for chrome and out-of-viewport areas. Default is unset which uses body color.
224224
- `MAX_DISPLAY_FILE_SIZE`: **8388608**: Max size of files to be displayed (default is 8MiB)
225225
- `REACTIONS`: All available reactions users can choose on issues/prs and comments
226226
Values can be emoji alias (:smile:) or a unicode emoji.

docs/content/doc/installation/from-source.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ This can be combined with `CC`, `GOOS`, and `GOARCH` as above.
201201
A script to enable bash-completion can be found at [`contrib/autocompletion/bash_autocomplete`](https://raw.githubusercontent.com/go-gitea/gitea/main/contrib/autocompletion/bash_autocomplete). This should be altered as appropriate and can be `source` in your `.bashrc`
202202
or copied as `/usr/share/bash-completion/completions/gitea`.
203203

204-
Similary a script for zsh-completion can be found at [`contrib/autocompletion/zsh_autocomplete`](https://raw.githubusercontent.com/go-gitea/gitea/main/contrib/autocompletion/zsh_autocomplete). This can be copied to `/usr/share/zsh/_gitea` or sourced within your
204+
Similarly, a script for zsh-completion can be found at [`contrib/autocompletion/zsh_autocomplete`](https://raw.githubusercontent.com/go-gitea/gitea/main/contrib/autocompletion/zsh_autocomplete). This can be copied to `/usr/share/zsh/_gitea` or sourced within your
205205
`.zshrc`.
206206

207207
YMMV and these scripts may need further improvement.

docs/content/doc/usage/packages/cargo.en-us.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ Publish [Cargo](https://doc.rust-lang.org/stable/cargo/) packages for your user
2525

2626
To work with the Cargo package registry, you need [Rust and Cargo](https://www.rust-lang.org/tools/install).
2727

28-
Cargo stores informations about the available packages in a package index stored in a git repository.
28+
Cargo stores information about the available packages in a package index stored in a git repository.
2929
This repository is needed to work with the registry.
3030
The following section describes how to create it.
3131

3232
## Index Repository
3333

34-
Cargo stores informations about the available packages in a package index stored in a git repository.
34+
Cargo stores information about the available packages in a package index stored in a git repository.
3535
In Gitea this repository has the special name `_cargo-index`.
3636
After a package was uploaded, its metadata is automatically written to the index.
3737
The content of this repository should not be manually modified.

docs/content/doc/usage/packages/storage.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ If two identical files are uploaded only one blob is saved on the filesystem.
2828
This ensures no space is wasted for duplicated files.
2929

3030
If two packages are uploaded with identical files, both packages will display the same size but on the filesystem they require only half of the size.
31-
Whenever a package gets deleted only the references to the underlaying blobs are removed.
31+
Whenever a package gets deleted, only the references to the underlying blobs are removed.
3232
The blobs get not removed at this moment, so they still require space on the filesystem.
3333
When a new package gets uploaded the existing blobs may get referenced again.
3434

models/git/lfs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ func IterateLFSMetaObjectsForRepo(ctx context.Context, repoID int64, f func(cont
390390

391391
for {
392392
beans := make([]*CountLFSMetaObject, 0, batchSize)
393-
sess := engine.Select("`lfs_meta_object`.*, COUNT(`l1`.oid) AS `count`").
393+
sess := engine.Table("lfs_meta_object").Select("`lfs_meta_object`.*, COUNT(`l1`.oid) AS `count`").
394394
Join("INNER", "`lfs_meta_object` AS l1", "`lfs_meta_object`.oid = `l1`.oid").
395395
Where("`lfs_meta_object`.repository_id = ?", repoID)
396396
if !opts.OlderThan.IsZero() {

models/issues/issue.go

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,6 +1251,8 @@ func (opts *IssuesOptions) setupSessionNoLimit(sess *xorm.Session) {
12511251

12521252
if opts.AssigneeID > 0 {
12531253
applyAssigneeCondition(sess, opts.AssigneeID)
1254+
} else if opts.AssigneeID == db.NoConditionID {
1255+
sess.Where("issue.id NOT IN (SELECT issue_id FROM issue_assignees)")
12541256
}
12551257

12561258
if opts.PosterID > 0 {
@@ -1312,13 +1314,17 @@ func (opts *IssuesOptions) setupSessionNoLimit(sess *xorm.Session) {
13121314
sess.And(builder.Eq{"repository.is_archived": opts.IsArchived.IsTrue()})
13131315
}
13141316

1315-
if opts.LabelIDs != nil {
1316-
for i, labelID := range opts.LabelIDs {
1317-
if labelID > 0 {
1318-
sess.Join("INNER", fmt.Sprintf("issue_label il%d", i),
1319-
fmt.Sprintf("issue.id = il%[1]d.issue_id AND il%[1]d.label_id = %[2]d", i, labelID))
1320-
} else {
1321-
sess.Where("issue.id not in (select issue_id from issue_label where label_id = ?)", -labelID)
1317+
if len(opts.LabelIDs) > 0 {
1318+
if opts.LabelIDs[0] == 0 {
1319+
sess.Where("issue.id NOT IN (SELECT issue_id FROM issue_label)")
1320+
} else {
1321+
for i, labelID := range opts.LabelIDs {
1322+
if labelID > 0 {
1323+
sess.Join("INNER", fmt.Sprintf("issue_label il%d", i),
1324+
fmt.Sprintf("issue.id = il%[1]d.issue_id AND il%[1]d.label_id = %[2]d", i, labelID))
1325+
} else if labelID < 0 { // 0 is not supported here, so just ignore it
1326+
sess.Where("issue.id not in (select issue_id from issue_label where label_id = ?)", -labelID)
1327+
}
13221328
}
13231329
}
13241330
}
@@ -1705,17 +1711,21 @@ func getIssueStatsChunk(opts *IssueStatsOptions, issueIDs []int64) (*IssueStats,
17051711
sess.In("issue.id", issueIDs)
17061712
}
17071713

1708-
if len(opts.Labels) > 0 && opts.Labels != "0" {
1714+
if len(opts.Labels) > 0 {
17091715
labelIDs, err := base.StringsToInt64s(strings.Split(opts.Labels, ","))
17101716
if err != nil {
17111717
log.Warn("Malformed Labels argument: %s", opts.Labels)
17121718
} else {
1713-
for i, labelID := range labelIDs {
1714-
if labelID > 0 {
1715-
sess.Join("INNER", fmt.Sprintf("issue_label il%d", i),
1716-
fmt.Sprintf("issue.id = il%[1]d.issue_id AND il%[1]d.label_id = %[2]d", i, labelID))
1717-
} else {
1718-
sess.Where("issue.id NOT IN (SELECT issue_id FROM issue_label WHERE label_id = ?)", -labelID)
1719+
if labelIDs[0] == 0 {
1720+
sess.Where("issue.id NOT IN (SELECT issue_id FROM issue_label)")
1721+
} else {
1722+
for i, labelID := range labelIDs {
1723+
if labelID > 0 {
1724+
sess.Join("INNER", fmt.Sprintf("issue_label il%d", i),
1725+
fmt.Sprintf("issue.id = il%[1]d.issue_id AND il%[1]d.label_id = %[2]d", i, labelID))
1726+
} else if labelID < 0 { // 0 is not supported here, so just ignore it
1727+
sess.Where("issue.id NOT IN (SELECT issue_id FROM issue_label WHERE label_id = ?)", -labelID)
1728+
}
17191729
}
17201730
}
17211731
}
@@ -1734,6 +1744,8 @@ func getIssueStatsChunk(opts *IssueStatsOptions, issueIDs []int64) (*IssueStats,
17341744

17351745
if opts.AssigneeID > 0 {
17361746
applyAssigneeCondition(sess, opts.AssigneeID)
1747+
} else if opts.AssigneeID == db.NoConditionID {
1748+
sess.Where("id NOT IN (SELECT issue_id FROM issue_assignees)")
17371749
}
17381750

17391751
if opts.PosterID > 0 {

models/organization/team_user.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ func GetTeamMembers(ctx context.Context, opts *SearchMembersOptions) ([]*user_mo
6363
Where(builder.Eq{"team_id": opts.TeamID}),
6464
)
6565
}
66-
if opts.PageSize > 0 && opts.Page > -1 {
67-
sess = sess.Limit(opts.PageSize, opts.Page*opts.PageSize)
66+
if opts.PageSize > 0 && opts.Page > 0 {
67+
sess = sess.Limit(opts.PageSize, (opts.Page-1)*opts.PageSize)
6868
}
6969
if err := sess.OrderBy("full_name, name").Find(&members); err != nil {
7070
return nil, err

models/secret/secret.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func newSecret(ownerID, repoID int64, name, data string) *Secret {
5959

6060
// InsertEncryptedSecret Creates, encrypts, and validates a new secret with yet unencrypted data and insert into database
6161
func InsertEncryptedSecret(ctx context.Context, ownerID, repoID int64, name, data string) (*Secret, error) {
62-
encrypted, err := secret_module.EncryptSecret(setting.SecretKey, strings.TrimSpace(data))
62+
encrypted, err := secret_module.EncryptSecret(setting.SecretKey, data)
6363
if err != nil {
6464
return nil, err
6565
}

modules/setting/mailer.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package setting
55

66
import (
7+
"context"
78
"net"
89
"net/mail"
910
"strings"
@@ -198,7 +199,7 @@ func loadMailerFrom(rootCfg ConfigProvider) {
198199
ips := tryResolveAddr(MailService.SMTPAddr)
199200
if MailService.Protocol == "smtp" {
200201
for _, ip := range ips {
201-
if !ip.IsLoopback() {
202+
if !ip.IP.IsLoopback() {
202203
log.Warn("connecting over insecure SMTP protocol to non-local address is not recommended")
203204
break
204205
}
@@ -258,20 +259,21 @@ func loadNotifyMailFrom(rootCfg ConfigProvider) {
258259
log.Info("Notify Mail Service Enabled")
259260
}
260261

261-
func tryResolveAddr(addr string) []net.IP {
262+
func tryResolveAddr(addr string) []net.IPAddr {
262263
if strings.HasPrefix(addr, "[") && strings.HasSuffix(addr, "]") {
263264
addr = addr[1 : len(addr)-1]
264265
}
265266
ip := net.ParseIP(addr)
266267
if ip != nil {
267-
ips := make([]net.IP, 1)
268-
ips[0] = ip
269-
return ips
268+
return []net.IPAddr{{IP: ip}}
270269
}
271-
ips, err := net.LookupIP(addr)
270+
271+
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
272+
defer cancel()
273+
ips, err := net.DefaultResolver.LookupIPAddr(ctx, addr)
272274
if err != nil {
273275
log.Warn("could not look up mailer.SMTP_ADDR: %v", err)
274-
return make([]net.IP, 0)
276+
return nil
275277
}
276278
return ips
277279
}

modules/storage/minio_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@
44
package storage
55

66
import (
7+
"os"
78
"testing"
89
)
910

1011
func TestMinioStorageIterator(t *testing.T) {
12+
if os.Getenv("CI") == "" {
13+
t.Skip("minioStorage not present outside of CI")
14+
return
15+
}
1116
testStorageIterator(t, string(MinioStorageType), MinioStorageConfig{
1217
Endpoint: "127.0.0.1:9000",
1318
AccessKeyID: "123456",

options/locale/locale_en-US.ini

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1361,6 +1361,7 @@ issues.delete_branch_at = `deleted branch <b>%s</b> %s`
13611361
issues.filter_label = Label
13621362
issues.filter_label_exclude = `Use <code>alt</code> + <code>click/enter</code> to exclude labels`
13631363
issues.filter_label_no_select = All labels
1364+
issues.filter_label_select_no_label = No Label
13641365
issues.filter_milestone = Milestone
13651366
issues.filter_milestone_all = All milestones
13661367
issues.filter_milestone_none = No milestones
@@ -1371,6 +1372,7 @@ issues.filter_project_all = All projects
13711372
issues.filter_project_none = No project
13721373
issues.filter_assignee = Assignee
13731374
issues.filter_assginee_no_select = All assignees
1375+
issues.filter_assginee_no_assignee = No assignee
13741376
issues.filter_poster = Author
13751377
issues.filter_poster_no_select = All authors
13761378
issues.filter_type = Type
@@ -2190,8 +2192,13 @@ settings.protect_merge_whitelist_committers_desc = Allow only whitelisted users
21902192
settings.protect_merge_whitelist_users = Whitelisted users for merging:
21912193
settings.protect_merge_whitelist_teams = Whitelisted teams for merging:
21922194
settings.protect_check_status_contexts = Enable Status Check
2193-
settings.protect_check_status_contexts_desc = Require status checks to pass before merging. Choose which status checks must pass before branches can be merged into a branch that matches this rule. When enabled, commits must first be pushed to another branch, then merged or pushed directly to a branch that matches this rule after status checks have passed. If no contexts are selected, the last commit must be successful regardless of context.
2195+
settings.protect_status_check_patterns = Status check patterns:
2196+
settings.protect_status_check_patterns_desc = Enter patterns to specify which status checks must pass before branches can be merged into a branch that matches this rule. Each line specifies a pattern. Patterns cannot be empty.
2197+
settings.protect_check_status_contexts_desc = Require status checks to pass before merging. When enabled, commits must first be pushed to another branch, then merged or pushed directly to a branch that matches this rule after status checks have passed. If no contexts are matched, the last commit must be successful regardless of context.
21942198
settings.protect_check_status_contexts_list = Status checks found in the last week for this repository
2199+
settings.protect_status_check_matched = Matched
2200+
settings.protect_invalid_status_check_pattern = Invalid status check pattern: "%s".
2201+
settings.protect_no_valid_status_check_patterns = No valid status check patterns.
21952202
settings.protect_required_approvals = Required approvals:
21962203
settings.protect_required_approvals_desc = Allow only to merge pull request with enough positive reviews.
21972204
settings.protect_approvals_whitelist_enabled = Restrict approvals to whitelisted users or teams

0 commit comments

Comments
 (0)