Skip to content

Commit 9c1599f

Browse files
authored
Merge branch 'main' into long-name-maxwidth-issue22866
2 parents a2a62d9 + 7f790c7 commit 9c1599f

Some content is hidden

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

46 files changed

+384
-169
lines changed

.drone.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ trigger:
1212
- push
1313
- tag
1414
- pull_request
15+
paths:
16+
exclude:
17+
- docs/**
1518

1619
volumes:
1720
- name: deps
@@ -112,7 +115,6 @@ steps:
112115
image: golang:1.19 # this step is kept as the lowest version of golang that we support
113116
pull: always
114117
environment:
115-
GO111MODULE: on
116118
GOPROXY: https://goproxy.io
117119
commands:
118120
- go build -o gitea_no_gcc # test if build succeeds without the sqlite tag
@@ -124,7 +126,6 @@ steps:
124126
- name: build-backend-arm64
125127
image: golang:1.20
126128
environment:
127-
GO111MODULE: on
128129
GOPROXY: https://goproxy.io
129130
GOOS: linux
130131
GOARCH: arm64
@@ -140,7 +141,6 @@ steps:
140141
- name: build-backend-windows
141142
image: golang:1.20
142143
environment:
143-
GO111MODULE: on
144144
GOPROXY: https://goproxy.io
145145
GOOS: windows
146146
GOARCH: amd64
@@ -155,7 +155,6 @@ steps:
155155
- name: build-backend-386
156156
image: golang:1.20
157157
environment:
158-
GO111MODULE: on
159158
GOPROXY: https://goproxy.io
160159
GOOS: linux
161160
GOARCH: 386
@@ -183,6 +182,9 @@ trigger:
183182
- push
184183
- tag
185184
- pull_request
185+
paths:
186+
exclude:
187+
- docs/**
186188

187189
volumes:
188190
- name: deps
@@ -410,6 +412,9 @@ trigger:
410412
- push
411413
- tag
412414
- pull_request
415+
paths:
416+
exclude:
417+
- docs/**
413418

414419
volumes:
415420
- name: deps
@@ -517,6 +522,9 @@ depends_on:
517522
trigger:
518523
event:
519524
- pull_request
525+
paths:
526+
exclude:
527+
- docs/**
520528

521529
volumes:
522530
- name: deps
@@ -696,6 +704,9 @@ trigger:
696704
- "release/*"
697705
event:
698706
- push
707+
paths:
708+
exclude:
709+
- docs/**
699710

700711
depends_on:
701712
- testing-amd64
@@ -947,6 +958,9 @@ trigger:
947958
- push
948959
- tag
949960
- pull_request
961+
paths:
962+
include:
963+
- docs/**
950964

951965
steps:
952966
- name: build-docs
@@ -1241,6 +1255,9 @@ depends_on:
12411255
trigger:
12421256
ref:
12431257
- "refs/pull/**"
1258+
paths:
1259+
exclude:
1260+
- docs/**
12441261

12451262
steps:
12461263
- name: dryrun

.github/pull_request_template.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
<!--
2-
1+
<!-- start tips -->
32
Please check the following:
4-
5-
1. Make sure you are targeting the `main` branch, pull requests on release branches are only allowed for bug fixes.
6-
2. Read contributing guidelines: https://github.com/go-gitea/gitea/blob/main/CONTRIBUTING.md
7-
3. Describe what your pull request does and which issue you're targeting (if any)
8-
9-
-->
3+
1. Make sure you are targeting the `main` branch, pull requests on release branches are only allowed for backports.
4+
2. Make sure you have read contributing guidelines: https://github.com/go-gitea/gitea/blob/main/CONTRIBUTING.md .
5+
3. Describe what your pull request does and which issue you're targeting (if any).
6+
4. It is recommended to enable "Allow edits by maintainers", so maintainers can help more easily.
7+
5. Your input here will be included in the commit message when this PR has been merged. If you don't want some content to be included, please separate them with a line like `---`.
8+
6. Delete all these tips before posting.
9+
<!-- end tips -->

CHANGELOG.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,43 @@ 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.18.4](https://github.com/go-gitea/gitea/releases/tag/1.18.4) - 2023-02-20
8+
9+
* SECURITY
10+
* Provide the ability to set password hash algorithm parameters (#22942) (#22943)
11+
* Add command to bulk set must-change-password (#22823) (#22928)
12+
* ENHANCEMENTS
13+
* Use import of OCI structs (#22765) (#22805)
14+
* Fix color of tertiary button on dark theme (#22739) (#22744)
15+
* Link issue and pull requests status change in UI notifications directly to their event in the timelined view. (#22627) (#22642)
16+
* BUGFIXES
17+
* Notify on container image create (#22806) (#22965)
18+
* Fix blame view missing lines (#22826) (#22929)
19+
* Fix incorrect role labels for migrated issues and comments (#22914) (#22923)
20+
* Fix PR file tree folders no longer collapsing (#22864) (#22872)
21+
* Escape filename when assemble URL (#22850) (#22871)
22+
* Fix isAllowed of escapeStreamer (#22814) (#22837)
23+
* Load issue before accessing index in merge message (#22822) (#22830)
24+
* Improve trace logging for pulls and processes (#22633) (#22812)
25+
* Fix restore repo bug, clarify the problem of ForeignIndex (#22776) (#22794)
26+
* Add default user visibility to cli command "admin user create" (#22750) (#22760)
27+
* Escape path for the file list (#22741) (#22757)
28+
* Fix bugs with WebAuthn preventing sign in and registration. (#22651) (#22721)
29+
* Add missing close bracket in imagediff (#22710) (#22712)
30+
* Move code comments to a standalone file and fix the bug when adding a reply to an outdated review appears to not post(#20821) (#22707)
31+
* Fix line spacing for plaintext previews (#22699) (#22701)
32+
* Fix wrong hint when deleting a branch successfully from pull request UI (#22673) (#22698)
33+
* Fix README TOC links (#22577) (#22677)
34+
* Fix missing message in git hook when pull requests disabled on fork (#22625) (#22658)
35+
* Improve checkIfPRContentChanged (#22611) (#22644)
36+
* Prevent duplicate labels when importing more than 99 (#22591) (#22598)
37+
* Don't return duplicated users who can create org repo (#22560) (#22562)
38+
* BUILD
39+
* Upgrade golangcilint to v1.51.0 (#22764)
40+
* MISC
41+
* Use proxy for pull mirror (#22771) (#22772)
42+
* Use `--index-url` in PyPi description (#22620) (#22636)
43+
744
## [1.18.3](https://github.com/go-gitea/gitea/releases/tag/v1.18.3) - 2023-01-23
845

946
* SECURITY

MAINTAINERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,5 @@ Wim <wim@42.be> (@42wim)
4747
Xinyu Zhou <i@sourcehut.net> (@xin-u)
4848
Jason Song <i@wolfogre.com> (@wolfogre)
4949
Yarden Shoham <hrsi88@gmail.com> (@yardenshoham)
50+
Yu Tian <zettat123@gmail.com> (@Zettat123)
51+
Eddie Yang <576951401@qq.com> (@yp05327)

docs/content/doc/developers/guidelines-frontend.en-us.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,20 @@ We recommend [Google HTML/CSS Style Guide](https://google.github.io/styleguide/h
3939
### Gitea specific guidelines:
4040

4141
1. Every feature (Fomantic-UI/jQuery module) should be put in separate files/directories.
42-
2. HTML ids and classes should use kebab-case.
42+
2. HTML ids and classes should use kebab-case, it's preferred to contain 2-3 feature related keywords.
4343
3. HTML ids and classes used in JavaScript should be unique for the whole project, and should contain 2-3 feature related keywords. We recommend to use the `js-` prefix for classes that are only used in JavaScript.
44-
4. jQuery events across different features could use their own namespaces if there are potential conflicts.
45-
5. CSS styling for classes provided by frameworks should not be overwritten. Always use new class-names with 2-3 feature related keywords to overwrite framework styles.
46-
6. The backend can pass complex data to the frontend by using `ctx.PageData["myModuleData"] = map[]{}`
47-
7. Simple pages and SEO-related pages use Go HTML Template render to generate static Fomantic-UI HTML output. Complex pages can use Vue3.
44+
4. CSS styling for classes provided by frameworks should not be overwritten. Always use new class names with 2-3 feature related keywords to overwrite framework styles. Gitea's helper CSS classes in `helpers.less` could be helpful.
45+
5. The backend can pass complex data to the frontend by using `ctx.PageData["myModuleData"] = map[]{}`, but do not expose whole models to the frontend to avoid leaking sensitive data.
46+
6. Simple pages and SEO-related pages use Go HTML Template render to generate static Fomantic-UI HTML output. Complex pages can use Vue3.
47+
7. Clarify variable types, prefer `elem.disabled = true` instead of `elem.setAttribute('disabled', 'anything')`, prefer `$el.prop('checked', var === 'yes')` instead of `$el.prop('checked', var)`.
48+
8. Use semantic elements, prefer `<button class="ui button">` instead of `<div class="ui button">`.
49+
9. Avoid unnecessary `!important` in CSS, add comments to explain why it's necessary if it can't be avoided.
50+
51+
### Accessibility / ARIA
52+
53+
In history, Gitea heavily uses Fomantic UI which is not an accessibility-friendly framework.
54+
Gitea uses some patches to make Fomantic UI more accessible (see the `aria.js` and `aria.md`),
55+
but there are still many problems which need a lot of work and time to fix.
4856

4957
### Framework Usage
5058

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ require (
103103
github.com/yuin/goldmark-highlighting/v2 v2.0.0-20220924101305-151362477c87
104104
github.com/yuin/goldmark-meta v1.1.0
105105
golang.org/x/crypto v0.4.0
106-
golang.org/x/net v0.4.0
106+
golang.org/x/net v0.7.0
107107
golang.org/x/oauth2 v0.3.0
108-
golang.org/x/sys v0.3.0
109-
golang.org/x/text v0.5.0
108+
golang.org/x/sys v0.5.0
109+
golang.org/x/text v0.7.0
110110
golang.org/x/tools v0.1.12
111111
google.golang.org/grpc v1.47.0
112112
google.golang.org/protobuf v1.28.1

go.sum

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,8 +1463,8 @@ golang.org/x/net v0.0.0-20220630215102-69896b714898/go.mod h1:XRhObCWvk6IyKnWLug
14631463
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
14641464
golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
14651465
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
1466-
golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU=
1467-
golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE=
1466+
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
1467+
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
14681468
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
14691469
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
14701470
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -1609,14 +1609,15 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc
16091609
golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
16101610
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
16111611
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1612-
golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ=
16131612
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1613+
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
1614+
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
16141615
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
16151616
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
16161617
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
16171618
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
16181619
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
1619-
golang.org/x/term v0.3.0 h1:qoo4akIqOcDME5bhc/NgxUdovd6BSS2uMsVjB56q1xI=
1620+
golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY=
16201621
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
16211622
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
16221623
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -1627,8 +1628,8 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
16271628
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
16281629
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
16291630
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
1630-
golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM=
1631-
golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
1631+
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
1632+
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
16321633
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
16331634
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
16341635
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=

models/auth/token_scope.go

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,23 @@ var allAccessTokenScopeBits = map[AccessTokenScope]AccessTokenScopeBitmap{
168168

169169
// Parse parses the scope string into a bitmap, thus removing possible duplicates.
170170
func (s AccessTokenScope) Parse() (AccessTokenScopeBitmap, error) {
171-
list := strings.Split(string(s), ",")
172-
173171
var bitmap AccessTokenScopeBitmap
174-
for _, v := range list {
172+
173+
// The following is the more performant equivalent of 'for _, v := range strings.Split(remainingScope, ",")' as this is hot code
174+
remainingScopes := string(s)
175+
for len(remainingScopes) > 0 {
176+
i := strings.IndexByte(remainingScopes, ',')
177+
var v string
178+
if i < 0 {
179+
v = remainingScopes
180+
remainingScopes = ""
181+
} else if i+1 >= len(remainingScopes) {
182+
v = remainingScopes[:i]
183+
remainingScopes = ""
184+
} else {
185+
v = remainingScopes[:i]
186+
remainingScopes = remainingScopes[i+1:]
187+
}
175188
singleScope := AccessTokenScope(v)
176189
if singleScope == "" {
177190
continue
@@ -187,9 +200,15 @@ func (s AccessTokenScope) Parse() (AccessTokenScopeBitmap, error) {
187200
}
188201
bitmap |= bits
189202
}
203+
190204
return bitmap, nil
191205
}
192206

207+
// StringSlice returns the AccessTokenScope as a []string
208+
func (s AccessTokenScope) StringSlice() []string {
209+
return strings.Split(string(s), ",")
210+
}
211+
193212
// Normalize returns a normalized scope string without any duplicates.
194213
func (s AccessTokenScope) Normalize() (AccessTokenScope, error) {
195214
bitmap, err := s.Parse()

models/issues/issue.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -251,13 +251,15 @@ func (issue *Issue) LoadPoster(ctx context.Context) (err error) {
251251

252252
// LoadPullRequest loads pull request info
253253
func (issue *Issue) LoadPullRequest(ctx context.Context) (err error) {
254-
if issue.IsPull && issue.PullRequest == nil {
255-
issue.PullRequest, err = GetPullRequestByIssueID(ctx, issue.ID)
256-
if err != nil {
257-
if IsErrPullRequestNotExist(err) {
258-
return err
254+
if issue.IsPull {
255+
if issue.PullRequest == nil {
256+
issue.PullRequest, err = GetPullRequestByIssueID(ctx, issue.ID)
257+
if err != nil {
258+
if IsErrPullRequestNotExist(err) {
259+
return err
260+
}
261+
return fmt.Errorf("getPullRequestByIssueID [%d]: %w", issue.ID, err)
259262
}
260-
return fmt.Errorf("getPullRequestByIssueID [%d]: %w", issue.ID, err)
261263
}
262264
issue.PullRequest.Issue = issue
263265
}
@@ -347,7 +349,7 @@ func (issue *Issue) LoadAttributes(ctx context.Context) (err error) {
347349
return
348350
}
349351

350-
if err = issue.loadProject(ctx); err != nil {
352+
if err = issue.LoadProject(ctx); err != nil {
351353
return
352354
}
353355

models/issues/issue_project.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@ import (
1313
)
1414

1515
// LoadProject load the project the issue was assigned to
16-
func (issue *Issue) LoadProject() (err error) {
17-
return issue.loadProject(db.DefaultContext)
18-
}
19-
20-
func (issue *Issue) loadProject(ctx context.Context) (err error) {
16+
func (issue *Issue) LoadProject(ctx context.Context) (err error) {
2117
if issue.Project == nil {
2218
var p project_model.Project
2319
if _, err = db.GetEngine(ctx).Table("project").

0 commit comments

Comments
 (0)