Skip to content

Commit e53b243

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: Fix icon margin in user/settings/repos (go-gitea#20281) Fix org label open count, including close count issue (go-gitea#20353) [skip ci] Updated translations via Crowdin Prevent context deadline error propagation in GetCommitsInfo (go-gitea#20346) Add missing return for when topic isn't found (go-gitea#20351) Upgrade to Node 18 on CI (go-gitea#20340) Fix checks in PR for empty commits go-gitea#19603 (go-gitea#20290) Use default values when provided values are empty (go-gitea#20318) Add tests for the host checking logic, clarify the behaviors (go-gitea#20328) Changelog for 1.16.9 (update) (go-gitea#20341) (go-gitea#20343) Fix various typos (go-gitea#20338) Correctly handle draft releases without a tag (go-gitea#20314) Add write check for creating Commit status (go-gitea#20332) Remove blue text on migrate page (go-gitea#20273) Updated dead link to Madeleine.js source (go-gitea#20322)
2 parents ad9544a + 1757053 commit e53b243

Some content is hidden

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

68 files changed

+198
-94
lines changed

.drone.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ volumes:
1919

2020
steps:
2121
- name: deps-frontend
22-
image: node:16
22+
image: node:18
2323
pull: always
2424
commands:
2525
- make deps-frontend
@@ -34,7 +34,7 @@ steps:
3434
path: /go
3535

3636
- name: lint-frontend
37-
image: node:16
37+
image: node:18
3838
commands:
3939
- make lint-frontend
4040
depends_on: [deps-frontend]
@@ -82,7 +82,7 @@ steps:
8282
path: /go
8383

8484
- name: checks-frontend
85-
image: node:16
85+
image: node:18
8686
commands:
8787
- make checks-frontend
8888
depends_on: [deps-frontend]
@@ -97,13 +97,13 @@ steps:
9797
path: /go
9898

9999
- name: test-frontend
100-
image: node:16
100+
image: node:18
101101
commands:
102102
- make test-frontend
103103
depends_on: [lint-frontend]
104104

105105
- name: build-frontend
106-
image: node:16
106+
image: node:18
107107
commands:
108108
- make frontend
109109
depends_on: [test-frontend]
@@ -634,7 +634,7 @@ steps:
634634
- git fetch --tags --force
635635

636636
- name: deps-frontend
637-
image: node:16
637+
image: node:18
638638
pull: always
639639
commands:
640640
- make deps-frontend
@@ -652,7 +652,7 @@ steps:
652652
image: techknowlogick/xgo:go-1.18.x
653653
pull: always
654654
commands:
655-
- curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs
655+
- curl -sL https://deb.nodesource.com/setup_18.x | bash - && apt-get install -y nodejs
656656
- export PATH=$PATH:$GOPATH/bin
657657
- make release
658658
environment:
@@ -753,7 +753,7 @@ steps:
753753
- git fetch --tags --force
754754

755755
- name: deps-frontend
756-
image: node:16
756+
image: node:18
757757
pull: always
758758
commands:
759759
- make deps-frontend
@@ -771,7 +771,7 @@ steps:
771771
image: techknowlogick/xgo:go-1.18.x
772772
pull: always
773773
commands:
774-
- curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs
774+
- curl -sL https://deb.nodesource.com/setup_18.x | bash - && apt-get install -y nodejs
775775
- export PATH=$PATH:$GOPATH/bin
776776
- make release
777777
environment:

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,15 @@ This changelog goes through all the changes that have been made in each release
44
without substantial changes to our git log; to see the highlights of what has
55
been added to each release, please refer to the [blog](https://blog.gitea.io).
66

7-
## [1.16.9](https://github.com/go-gitea/gitea/releases/tag/v1.16.9) - 2022-06-21
7+
## [1.16.9](https://github.com/go-gitea/gitea/releases/tag/v1.16.9) - 2022-07-12
88

9+
* SECURITY
10+
* Add write check for creating Commit status (#20332) (#20334)
11+
* Check for permission when fetching user controlled issues (#20133) (#20196)
912
* BUGFIXES
13+
* Hide notify mail setting ui if not enabled (#20138) (#20337)
14+
* Add write check for creating Commit status (#20332) (#20334)
15+
* Only show Followers that current user can access (#20220) (#20253)
1016
* Release page show all tags in compare dropdown (#20070) (#20071)
1117
* Fix permission check for delete tag (#19985) (#20001)
1218
* Only log non ErrNotExist errors in git.GetNote (#19884) (#19905)

Dockerfile.rootless

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ ENV GITEA_CUSTOM /var/lib/gitea/custom
6262
ENV GITEA_TEMP /tmp/gitea
6363
ENV TMPDIR /tmp/gitea
6464

65-
#TODO add to docs the ability to define the ini to load (usefull to test and revert a config)
65+
#TODO add to docs the ability to define the ini to load (useful to test and revert a config)
6666
ENV GITEA_APP_INI /etc/gitea/app.ini
6767
ENV HOME "/var/lib/gitea/git"
6868
VOLUME ["/var/lib/gitea", "/etc/gitea"]

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ generate-manpage:
771771
@mkdir -p man/man1/ man/man5
772772
@./gitea docs --man > man/man1/gitea.1
773773
@gzip -9 man/man1/gitea.1 && echo man/man1/gitea.1.gz created
774-
@#TODO A smal script witch format config-cheat-sheet.en-us.md nicely to suit as config man page
774+
@#TODO A small script that formats config-cheat-sheet.en-us.md nicely for use as a config man page
775775

776776
.PHONY: pr\#%
777777
pr\#%: clean-all

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ NOTES:
102102

103103
Translations are done through Crowdin. If you want to translate to a new language ask one of the managers in the Crowdin project to add a new language there.
104104

105-
You can also just create an issue for adding a language or ask on discord on the #translation channel. If you need context or find some translation issues, you can leave a comment on the string or ask on Discord. For general translation questions there is a section in the docs. Currently a bit empty but we hope fo fill it as questions pop up.
105+
You can also just create an issue for adding a language or ask on discord on the #translation channel. If you need context or find some translation issues, you can leave a comment on the string or ask on Discord. For general translation questions there is a section in the docs. Currently a bit empty but we hope to fill it as questions pop up.
106106

107107
https://docs.gitea.io/en-us/translation-guidelines/
108108

cmd/manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ var (
8282
},
8383
cli.BoolFlag{
8484
Name: "no-system",
85-
Usage: "Do not show system proceses",
85+
Usage: "Do not show system processes",
8686
},
8787
cli.BoolFlag{
8888
Name: "stacktraces",

custom/conf/app.example.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2232,6 +2232,7 @@ ROUTER = console
22322232
;BLOCKED_DOMAINS =
22332233
;;
22342234
;; Allow private addresses defined by RFC 1918, RFC 1122, RFC 4632 and RFC 4291 (false by default)
2235+
;; If a domain is allowed by ALLOWED_DOMAINS, this option will be ignored.
22352236
;ALLOW_LOCALNETWORKS = false
22362237

22372238
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,7 @@ Task queue configuration has been moved to `queue.task`. However, the below conf
10831083
- `RETRY_BACKOFF`: **3**: Backoff time per http/https request retry (seconds)
10841084
- `ALLOWED_DOMAINS`: **\<empty\>**: Domains allowlist for migrating repositories, default is blank. It means everything will be allowed. Multiple domains could be separated by commas. Wildcard is supported: `github.com, *.github.com`.
10851085
- `BLOCKED_DOMAINS`: **\<empty\>**: Domains blocklist for migrating repositories, default is blank. Multiple domains could be separated by commas. When `ALLOWED_DOMAINS` is not blank, this option has a higher priority to deny domains. Wildcard is supported.
1086-
- `ALLOW_LOCALNETWORKS`: **false**: Allow private addresses defined by RFC 1918, RFC 1122, RFC 4632 and RFC 4291
1086+
- `ALLOW_LOCALNETWORKS`: **false**: Allow private addresses defined by RFC 1918, RFC 1122, RFC 4632 and RFC 4291. If a domain is allowed by `ALLOWED_DOMAINS`, this option will be ignored.
10871087
- `SKIP_TLS_VERIFY`: **false**: Allow skip tls verify
10881088

10891089
## Federation (`federation`)

docs/content/doc/advanced/config-cheat-sheet.zh-cn.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ ALLOW_DATA_URI_IMAGES = true
346346
- `ALLOW_DATA_URI_IMAGES`: **false** 允许 data uri 图片 (`<img src="data:image/png;base64,..."/>`)。
347347

348348
多个净化规则可以被同时定义,只要section名称最后一位不重复即可。如: `[markup.sanitizer.TeX-2]`
349-
为了针对一种渲染类型进行一个特殊的净化策略,必须使用形如 `[markup.sanitizer.asciidoc.rule-1]` 的方式来命名 seciton
349+
为了针对一种渲染类型进行一个特殊的净化策略,必须使用形如 `[markup.sanitizer.asciidoc.rule-1]` 的方式来命名 section
350350
如果此规则没有匹配到任何渲染类型,它将会被应用到所有的渲染类型。
351351

352352
## Time (`time`)

docs/content/doc/advanced/customizing-gitea.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ You can display STL file directly in Gitea by adding:
202202

203203
to the file `templates/custom/footer.tmpl`
204204

205-
You also need to download the content of the library [Madeleine.js](https://jinjunho.github.io/Madeleine.js/) and place it under `$GITEA_CUSTOM/public/` folder.
205+
You also need to download the content of the library [Madeleine.js](https://github.com/beige90/Madeleine.js) and place it under `$GITEA_CUSTOM/public/` folder.
206206

207207
You should end-up with a folder structure similar to:
208208

docs/content/doc/packages/nuget.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Publish [NuGet](https://www.nuget.org/) packages for your user or organization.
2323
## Requirements
2424

2525
To work with the NuGet package registry, you can use command-line interface tools as well as NuGet features in various IDEs like Visual Studio.
26-
More informations about NuGet clients can be found in [the official documentation](https://docs.microsoft.com/en-us/nuget/install-nuget-client-tools).
26+
More information about NuGet clients can be found in [the official documentation](https://docs.microsoft.com/en-us/nuget/install-nuget-client-tools).
2727
The following examples use the `dotnet nuget` tool.
2828

2929
## Configuring the package registry

integrations/dump_restore_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ func (c *compareDump) assertEquals(repoBefore, repoAfter *repo_model.Repository)
201201
"Assignees": {ignore: true}, // not implemented yet
202202
"Head": {nested: comparePullRequestBranch},
203203
"Base": {nested: comparePullRequestBranch},
204-
"Labels": {ignore: true}, // because org labels are not handled propery
204+
"Labels": {ignore: true}, // because org labels are not handled properly
205205
}).([]*base.PullRequest)
206206
assert.True(c.t, ok)
207207
assert.GreaterOrEqual(c.t, len(prs), 1)

integrations/pull_status_test.go

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,11 @@ func doAPICreateCommitStatus(ctx APITestContext, commitID string, status api.Com
105105
}
106106
}
107107

108-
func TestPullCreate_EmptyChangesWithCommits(t *testing.T) {
108+
func TestPullCreate_EmptyChangesWithDifferentCommits(t *testing.T) {
109+
// Merge must continue if commits SHA are different, even if content is same
110+
// Reason: gitflow and merging master back into develop, where is high possiblity, there are no changes
111+
// but just commit saying "Merge branch". And this meta commit can be also tagged,
112+
// so we need to have this meta commit also in develop branch.
109113
onGiteaRun(t, func(t *testing.T, u *url.URL) {
110114
session := loginUser(t, "user1")
111115
testRepoFork(t, session, "user2", "repo1", "user1", "repo1")
@@ -126,6 +130,28 @@ func TestPullCreate_EmptyChangesWithCommits(t *testing.T) {
126130
doc := NewHTMLParser(t, resp.Body)
127131

128132
text := strings.TrimSpace(doc.doc.Find(".merge-section").Text())
129-
assert.Contains(t, text, "This branch is equal with the target branch.")
133+
assert.Contains(t, text, "This pull request can be merged automatically.")
134+
})
135+
}
136+
137+
func TestPullCreate_EmptyChangesWithSameCommits(t *testing.T) {
138+
onGiteaRun(t, func(t *testing.T, u *url.URL) {
139+
session := loginUser(t, "user1")
140+
testRepoFork(t, session, "user2", "repo1", "user1", "repo1")
141+
testCreateBranch(t, session, "user1", "repo1", "branch/master", "status1", http.StatusSeeOther)
142+
url := path.Join("user1", "repo1", "compare", "master...status1")
143+
req := NewRequestWithValues(t, "POST", url,
144+
map[string]string{
145+
"_csrf": GetCSRF(t, session, url),
146+
"title": "pull request from status1",
147+
},
148+
)
149+
session.MakeRequest(t, req, http.StatusSeeOther)
150+
req = NewRequest(t, "GET", "/user1/repo1/pulls/1")
151+
resp := session.MakeRequest(t, req, http.StatusOK)
152+
doc := NewHTMLParser(t, resp.Body)
153+
154+
text := strings.TrimSpace(doc.doc.Find(".merge-section").Text())
155+
assert.Contains(t, text, "This branch is already included in the target branch. There is nothing to merge.")
130156
})
131157
}

models/db/context.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func TxContext() (*Context, Committer, error) {
100100
}
101101

102102
// WithTx represents executing database operations on a transaction
103-
// you can optionally change the context to a parrent one
103+
// you can optionally change the context to a parent one
104104
func WithTx(f func(ctx context.Context) error, stdCtx ...context.Context) error {
105105
parentCtx := DefaultContext
106106
if len(stdCtx) != 0 && stdCtx[0] != nil {

models/issues/label.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"code.gitea.io/gitea/models/db"
1818
user_model "code.gitea.io/gitea/models/user"
1919
"code.gitea.io/gitea/modules/timeutil"
20+
"code.gitea.io/gitea/modules/util"
2021

2122
"xorm.io/builder"
2223
)
@@ -107,6 +108,7 @@ func (label *Label) CalOpenOrgIssues(repoID, labelID int64) {
107108
counts, _ := CountIssuesByRepo(&IssuesOptions{
108109
RepoID: repoID,
109110
LabelIDs: []int64{labelID},
111+
IsClosed: util.OptionalBoolFalse,
110112
})
111113

112114
for _, count := range counts {

models/issues/pull.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ const (
122122
PullRequestStatusManuallyMerged
123123
PullRequestStatusError
124124
PullRequestStatusEmpty
125+
PullRequestStatusAncestor
125126
)
126127

127128
// PullRequestFlow the flow of pull request
@@ -423,6 +424,11 @@ func (pr *PullRequest) IsEmpty() bool {
423424
return pr.Status == PullRequestStatusEmpty
424425
}
425426

427+
// IsAncestor returns true if the Head Commit of this PR is an ancestor of the Base Commit
428+
func (pr *PullRequest) IsAncestor() bool {
429+
return pr.Status == PullRequestStatusAncestor
430+
}
431+
426432
// SetMerged sets a pull request to merged and closes the corresponding issue
427433
func (pr *PullRequest) SetMerged(ctx context.Context) (bool, error) {
428434
if pr.HasMerged {

models/issues/pull_list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func GetUnmergedPullRequestsByHeadInfo(repoID int64, branch string) ([]*PullRequ
6262
Find(&prs)
6363
}
6464

65-
// CanMaintainerWriteToBranch check whether user is a matainer and could write to the branch
65+
// CanMaintainerWriteToBranch check whether user is a maintainer and could write to the branch
6666
func CanMaintainerWriteToBranch(p access_model.Permission, branch string, user *user_model.User) bool {
6767
if p.CanWrite(unit.TypeCode) {
6868
return true

models/organization/team_repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func GetTeamRepositories(ctx context.Context, opts *SearchTeamRepoOptions) ([]*r
5555
Find(&repos)
5656
}
5757

58-
// AddTeamRepo addes a repo for an organization's team
58+
// AddTeamRepo adds a repo for an organization's team
5959
func AddTeamRepo(ctx context.Context, orgID, teamID, repoID int64) error {
6060
_, err := db.GetEngine(ctx).Insert(&TeamRepo{
6161
OrgID: orgID,

modules/charset/charset.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
// UTF8BOM is the utf-8 byte-order marker
2424
var UTF8BOM = []byte{'\xef', '\xbb', '\xbf'}
2525

26-
// ToUTF8WithFallbackReader detects the encoding of content and coverts to UTF-8 reader if possible
26+
// ToUTF8WithFallbackReader detects the encoding of content and converts to UTF-8 reader if possible
2727
func ToUTF8WithFallbackReader(rd io.Reader) io.Reader {
2828
buf := make([]byte, 2048)
2929
n, err := util.ReadAtMost(rd, buf)
@@ -76,7 +76,7 @@ func ToUTF8WithErr(content []byte) (string, error) {
7676
return string(result), err
7777
}
7878

79-
// ToUTF8WithFallback detects the encoding of content and coverts to UTF-8 if possible
79+
// ToUTF8WithFallback detects the encoding of content and converts to UTF-8 if possible
8080
func ToUTF8WithFallback(content []byte) []byte {
8181
bs, _ := io.ReadAll(ToUTF8WithFallbackReader(bytes.NewReader(content)))
8282
return bs
@@ -191,7 +191,7 @@ func DetectEncoding(content []byte) (string, error) {
191191
break
192192
}
193193

194-
// Otherwise check if this results is earlier in the DetectedCharsetOrder than our current top guesss
194+
// Otherwise check if this results is earlier in the DetectedCharsetOrder than our current top guess
195195
resultPriority, resultHas := setting.Repository.DetectedCharsetScore[strings.ToLower(strings.TrimSpace(result.Charset))]
196196
if resultHas && (!has || resultPriority < priority) {
197197
topResult = result

modules/doctor/breaking.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ func iterateUserAccounts(ctx context.Context, each func(*user.User) error) error
3232
// Ref: https://github.com/go-gitea/gitea/pull/19085 & https://github.com/go-gitea/gitea/pull/17688
3333
func checkUserEmail(ctx context.Context, logger log.Logger, _ bool) error {
3434
// We could use quirky SQL to get all users that start without a [a-zA-Z0-9], but that would mean
35-
// DB provider-specific SQL and only works _now_. So instead we iterate trough all user accounts and
36-
// use the user.ValidateEmail function to be future-proof.
35+
// DB provider-specific SQL and only works _now_. So instead we iterate through all user accounts
36+
// and use the user.ValidateEmail function to be future-proof.
3737
var invalidUserCount int64
3838
if err := iterateUserAccounts(ctx, func(u *user.User) error {
3939
// Only check for users, skip

modules/git/log_name_status.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"bufio"
99
"bytes"
1010
"context"
11+
"errors"
1112
"io"
1213
"path"
1314
"sort"
@@ -62,9 +63,10 @@ func LogNameStatusRepo(ctx context.Context, repository, head, treepath string, p
6263
})
6364
if err != nil {
6465
_ = stdoutWriter.CloseWithError(ConcatenateError(err, (&stderr).String()))
65-
} else {
66-
_ = stdoutWriter.Close()
66+
return
6767
}
68+
69+
_ = stdoutWriter.Close()
6870
}()
6971

7072
// For simplicities sake we'll us a buffered reader to read from the cat-file --batch
@@ -354,7 +356,7 @@ heaploop:
354356
}
355357
current, err := g.Next(treepath, path2idx, changed, maxpathlen)
356358
if err != nil {
357-
if err == context.DeadlineExceeded {
359+
if errors.Is(err, context.DeadlineExceeded) {
358360
break heaploop
359361
}
360362
g.Close()

modules/hostmatcher/hostmatcher.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,14 @@ func (hl *HostMatchList) checkIP(ip net.IP) bool {
125125

126126
// MatchHostName checks if the host matches an allow/deny(block) list
127127
func (hl *HostMatchList) MatchHostName(host string) bool {
128+
if hl == nil {
129+
return false
130+
}
131+
128132
hostname, _, err := net.SplitHostPort(host)
129133
if err != nil {
130134
hostname = host
131135
}
132-
133-
if hl == nil {
134-
return false
135-
}
136136
if hl.checkPattern(hostname) {
137137
return true
138138
}

modules/nosql/manager_leveldb.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func (m *Manager) getLevelDB(connection string) (*leveldb.DB, error) {
103103
db, ok = m.LevelDBConnections[dataDir]
104104
if ok {
105105
db.count++
106-
log.Warn("Duplicate connnection to level db: %s with different connection strings. Initial connection: %s. This connection: %s", dataDir, db.name[0], connection)
106+
log.Warn("Duplicate connection to level db: %s with different connection strings. Initial connection: %s. This connection: %s", dataDir, db.name[0], connection)
107107
db.name = append(db.name, connection)
108108
m.LevelDBConnections[connection] = db
109109
return db.db, nil

0 commit comments

Comments
 (0)