Skip to content

Commit ebee69d

Browse files
Merge branch 'main' into blender-filter-issues-by-project
2 parents b52aba2 + c8139c0 commit ebee69d

File tree

379 files changed

+3102
-1865
lines changed

Some content is hidden

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

379 files changed

+3102
-1865
lines changed

.drone.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ steps:
555555

556556
# TODO: We should probably build all dependencies into a test image
557557
- name: test-e2e
558-
image: mcr.microsoft.com/playwright:v1.29.0-focal
558+
image: mcr.microsoft.com/playwright:v1.29.2-focal
559559
commands:
560560
- curl -sLO https://go.dev/dl/go1.19.linux-amd64.tar.gz && tar -C /usr/local -xzf go1.19.linux-amd64.tar.gz
561561
- groupadd --gid 1001 gitea && useradd -m --gid 1001 --uid 1001 gitea

.eslintrc.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ rules:
8484
id-length: [0]
8585
id-match: [0]
8686
implicit-arrow-linebreak: [0]
87+
import/consistent-type-specifier-style: [0]
8788
import/default: [0]
8889
import/dynamic-import-chunkname: [0]
8990
import/export: [2]
@@ -103,6 +104,7 @@ rules:
103104
import/no-default-export: [0]
104105
import/no-deprecated: [0]
105106
import/no-dynamic-require: [0]
107+
import/no-empty-named-blocks: [2]
106108
import/no-extraneous-dependencies: [2]
107109
import/no-import-module-exports: [0]
108110
import/no-internal-modules: [0]

.gitpod.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ tasks:
77
command: |
88
gp sync-done setup
99
exit 0
10-
- name: Run frontend
11-
command: |
12-
gp sync-await setup
13-
make watch-frontend
1410
- name: Run backend
1511
command: |
1612
gp sync-await setup
@@ -19,9 +15,15 @@ tasks:
1915
echo -e "\n[database]\nDB_TYPE = sqlite3\nPATH = $GITPOD_REPO_ROOT/data/gitea.db" >> custom/conf/app.ini
2016
export TAGS="sqlite sqlite_unlock_notify"
2117
make watch-backend
18+
- name: Run frontend
19+
command: |
20+
gp sync-await setup
21+
make watch-frontend
22+
openMode: split-right
2223
- name: Run docs
2324
before: sudo bash -c "$(grep 'https://github.com/gohugoio/hugo/releases/download' Makefile | tr -d '\')" # install hugo
2425
command: cd docs && make clean update && hugo server -D -F --baseUrl $(gp url 1313) --liveReloadPort=443 --appendPort=false --bind=0.0.0.0
26+
openMode: split-right
2527

2628
vscode:
2729
extensions:

CHANGELOG.md

+19
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,25 @@ 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.3](https://github.com/go-gitea/gitea/releases/tag/v1.18.3) - 2023-01-23
8+
9+
* SECURITY
10+
* Prevent multiple `To` recipients (#22566) (#22569)
11+
* BUGFIXES
12+
* Truncate commit summary on repo files table. (#22551) (#22552)
13+
* Mute all links in issue timeline (#22534)
14+
15+
## [1.18.2](https://github.com/go-gitea/gitea/releases/tag/v1.18.2) - 2023-01-19
16+
17+
* BUGFIXES
18+
* Fix issue not auto-closing when it includes a reference to a branch (#22514) (#22521)
19+
* Fix invalid issue branch reference if not specified in template (#22513) (#22520)
20+
* Fix 500 error viewing pull request when fork has pull requests disabled (#22512) (#22515)
21+
* Reliable selection of admin user (#22509) (#22511)
22+
* Set disable_gravatar/enable_federated_avatar when offline mode is true (#22479) (#22496)
23+
* BUILD
24+
* cgo cross-compile for freebsd (#22397) (#22519)
25+
726
## [1.18.1](https://github.com/go-gitea/gitea/releases/tag/v1.18.1) - 2023-01-17
827

928
* API

DCO

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ Developer Certificate of Origin
22
Version 1.1
33

44
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
5-
660 York Street, Suite 102,
6-
San Francisco, CA 94110 USA
75

86
Everyone is permitted to copy and distribute verbatim copies of this
97
license document, but changing it is not allowed.
@@ -33,4 +31,4 @@ By making a contribution to this project, I certify that:
3331
are public and that a record of the contribution (including all
3432
personal information I submit with it, including my sign-off) is
3533
maintained indefinitely and may be redistributed consistent with
36-
this project or the open source license(s) involved.
34+
this project or the open source license(s) involved.

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
<a href="https://discord.gg/Gitea" title="Join the Discord chat at https://discord.gg/Gitea">
1313
<img src="https://img.shields.io/discord/322538954119184384.svg">
1414
</a>
15-
<a href="https://codecov.io/gh/go-gitea/gitea" title="Codecov">
15+
<a href="https://app.codecov.io/gh/go-gitea/gitea" title="Codecov">
1616
<img src="https://codecov.io/gh/go-gitea/gitea/branch/main/graph/badge.svg">
1717
</a>
1818
<a href="https://goreportcard.com/report/code.gitea.io/gitea" title="Go Report Card">
1919
<img src="https://goreportcard.com/badge/code.gitea.io/gitea">
2020
</a>
21-
<a href="https://godoc.org/code.gitea.io/gitea" title="GoDoc">
22-
<img src="https://godoc.org/code.gitea.io/gitea?status.svg">
21+
<a href="https://pkg.go.dev/code.gitea.io/gitea" title="GoDoc">
22+
<img src="https://pkg.go.dev/badge/code.gitea.io/gitea?status.svg">
2323
</a>
2424
<a href="https://github.com/go-gitea/gitea/releases/latest" title="GitHub release">
2525
<img src="https://img.shields.io/github/release/go-gitea/gitea.svg">
@@ -45,7 +45,7 @@
4545
<a href="https://www.tickgit.com/browse?repo=github.com/go-gitea/gitea&branch=main" title="TODOs">
4646
<img src="https://badgen.net/https/api.tickgit.com/badgen/github.com/go-gitea/gitea/main">
4747
</a>
48-
<a href="https://www.bountysource.com/teams/gitea" title="Bountysource">
48+
<a href="https://app.bountysource.com/teams/gitea" title="Bountysource">
4949
<img src="https://img.shields.io/bountysource/team/gitea/activity">
5050
</a>
5151
</p>

README_ZH.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
<a href="https://discord.gg/Gitea" title="Join the Discord chat at https://discord.gg/Gitea">
1313
<img src="https://img.shields.io/discord/322538954119184384.svg">
1414
</a>
15-
<a href="https://codecov.io/gh/go-gitea/gitea" title="Codecov">
15+
<a href="https://app.codecov.io/gh/go-gitea/gitea" title="Codecov">
1616
<img src="https://codecov.io/gh/go-gitea/gitea/branch/main/graph/badge.svg">
1717
</a>
1818
<a href="https://goreportcard.com/report/code.gitea.io/gitea" title="Go Report Card">
1919
<img src="https://goreportcard.com/badge/code.gitea.io/gitea">
2020
</a>
21-
<a href="https://godoc.org/code.gitea.io/gitea" title="GoDoc">
22-
<img src="https://godoc.org/code.gitea.io/gitea?status.svg">
21+
<a href="https://pkg.go.dev/code.gitea.io/gitea" title="GoDoc">
22+
<img src="https://pkg.go.dev/badge/code.gitea.io/gitea?status.svg">
2323
</a>
2424
<a href="https://github.com/go-gitea/gitea/releases/latest" title="GitHub release">
2525
<img src="https://img.shields.io/github/release/go-gitea/gitea.svg">
@@ -45,7 +45,7 @@
4545
<a href="https://www.tickgit.com/browse?repo=github.com/go-gitea/gitea&branch=main" title="TODOs">
4646
<img src="https://badgen.net/https/api.tickgit.com/badgen/github.com/go-gitea/gitea/main">
4747
</a>
48-
<a href="https://img.shields.io/bountysource/team/gitea" title="Bountysource">
48+
<a href="https://app.bountysource.com/teams/gitea" title="Bountysource">
4949
<img src="https://img.shields.io/bountysource/team/gitea/activity">
5050
</a>
5151
</p>

custom/conf/app.example.ini

+4-4
Original file line numberDiff line numberDiff line change
@@ -1721,7 +1721,7 @@ ROUTER = console
17211721
;INTERVAL = 60
17221722
;;
17231723
;; For "redis" and "memcache", connection host address
1724-
;; redis: network=tcp,addr=:6379,password=macaron,db=0,pool_size=100,idle_timeout=180
1724+
;; redis: `redis://127.0.0.1:6379/0?pool_size=100&idle_timeout=180s`
17251725
;; memcache: `127.0.0.1:11211`
17261726
;; twoqueue: `{"size":50000,"recent_ratio":0.25,"ghost_ratio":0.5}` or `50000`
17271727
;HOST =
@@ -1760,7 +1760,7 @@ ROUTER = console
17601760
;; Provider config options
17611761
;; memory: doesn't have any config yet
17621762
;; file: session file path, e.g. `data/sessions`
1763-
;; redis: network=tcp,addr=:6379,password=macaron,db=0,pool_size=100,idle_timeout=180
1763+
;; redis: `redis://127.0.0.1:6379/0?pool_size=100&idle_timeout=180s`
17641764
;; mysql: go-sql-driver/mysql dsn config string, e.g. `root:password@/session_table`
17651765
;PROVIDER_CONFIG = data/sessions ; Relative paths will be made absolute against _`AppWorkPath`_.
17661766
;;
@@ -2380,8 +2380,8 @@ ROUTER = console
23802380
;QUEUE_LENGTH = 1000
23812381
;;
23822382
;; Task queue connection string, available only when `QUEUE_TYPE` is `redis`.
2383-
;; If there is a password of redis, use `addrs=127.0.0.1:6379 password=123 db=0`.
2384-
;QUEUE_CONN_STR = "addrs=127.0.0.1:6379 db=0"
2383+
;; If there is a password of redis, use `redis://127.0.0.1:6379/0?pool_size=100&idle_timeout=180s`.
2384+
;QUEUE_CONN_STR = "redis://127.0.0.1:6379/0?pool_size=100&idle_timeout=180s"
23852385

23862386
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
23872387
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

docs/content/doc/features/comparison.en-us.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ _Symbols used in table:_
7474
| Granular user roles (Code, Issues, Wiki, …) ||||||||
7575
| Verified Committer ||| ? |||||
7676
| GPG Signed Commits ||||||||
77-
| SSH Signed Commits |||| | | ? | ? |
77+
| SSH Signed Commits |||| | | ? | ? |
7878
| Reject unsigned commits ||||||||
7979
| Migrating repos from other services ||||||||
8080
| Repository Activity page ||||||||

models/fixtures/project.yml

+9
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,12 @@
2424
creator_id: 5
2525
board_type: 1
2626
type: 2
27+
28+
-
29+
id: 4
30+
title: project on user2
31+
owner_id: 2
32+
is_closed: false
33+
creator_id: 2
34+
board_type: 1
35+
type: 2

models/fixtures/project_board.yml

+8
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,11 @@
2121
creator_id: 2
2222
created_unix: 1588117528
2323
updated_unix: 1588117528
24+
25+
-
26+
id: 4
27+
project_id: 4
28+
title: Done
29+
creator_id: 2
30+
created_unix: 1588117528
31+
updated_unix: 1588117528

models/issues/comment.go

+9
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,15 @@ func (t CommentType) String() string {
175175
return commentStrings[t]
176176
}
177177

178+
func AsCommentType(typeName string) CommentType {
179+
for index, name := range commentStrings {
180+
if typeName == name {
181+
return CommentType(index)
182+
}
183+
}
184+
return CommentTypeUnknown
185+
}
186+
178187
// RoleDescriptor defines comment tag type
179188
type RoleDescriptor int
180189

models/issues/comment_test.go

+7
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,10 @@ func TestFetchCodeComments(t *testing.T) {
6262
assert.NoError(t, err)
6363
assert.Len(t, res, 1)
6464
}
65+
66+
func TestAsCommentType(t *testing.T) {
67+
assert.Equal(t, issues_model.CommentTypeUnknown, issues_model.AsCommentType(""))
68+
assert.Equal(t, issues_model.CommentTypeUnknown, issues_model.AsCommentType("nonsense"))
69+
assert.Equal(t, issues_model.CommentTypeComment, issues_model.AsCommentType("comment"))
70+
assert.Equal(t, issues_model.CommentTypePRUnScheduledToAutoMerge, issues_model.AsCommentType("pull_cancel_scheduled_merge"))
71+
}

models/issues/issue.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1098,7 +1098,7 @@ func GetIssueWithAttrsByID(id int64) (*Issue, error) {
10981098
}
10991099

11001100
// GetIssuesByIDs return issues with the given IDs.
1101-
func GetIssuesByIDs(ctx context.Context, issueIDs []int64) ([]*Issue, error) {
1101+
func GetIssuesByIDs(ctx context.Context, issueIDs []int64) (IssueList, error) {
11021102
issues := make([]*Issue, 0, 10)
11031103
return issues, db.GetEngine(ctx).In("id", issueIDs).Find(&issues)
11041104
}

models/issues/issue_project.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,17 @@ func ChangeProjectAssign(issue *Issue, doer *user_model.User, newProjectID int64
125125
func addUpdateIssueProject(ctx context.Context, issue *Issue, doer *user_model.User, newProjectID int64) error {
126126
oldProjectID := issue.projectID(ctx)
127127

128+
if err := issue.LoadRepo(ctx); err != nil {
129+
return err
130+
}
131+
128132
// Only check if we add a new project and not remove it.
129133
if newProjectID > 0 {
130134
newProject, err := project_model.GetProjectByID(ctx, newProjectID)
131135
if err != nil {
132136
return err
133137
}
134-
if newProject.RepoID != issue.RepoID {
138+
if newProject.RepoID != issue.RepoID && newProject.OwnerID != issue.Repo.OwnerID {
135139
return fmt.Errorf("issue's repository is not the same as project's repository")
136140
}
137141
}
@@ -140,10 +144,6 @@ func addUpdateIssueProject(ctx context.Context, issue *Issue, doer *user_model.U
140144
return err
141145
}
142146

143-
if err := issue.LoadRepo(ctx); err != nil {
144-
return err
145-
}
146-
147147
if oldProjectID > 0 || newProjectID > 0 {
148148
if _, err := CreateComment(ctx, &CreateCommentOptions{
149149
Type: CommentTypeProject,

models/organization/team.go

-65
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ import (
1616
user_model "code.gitea.io/gitea/models/user"
1717
"code.gitea.io/gitea/modules/log"
1818
"code.gitea.io/gitea/modules/util"
19-
20-
"xorm.io/builder"
2119
)
2220

2321
// ___________
@@ -96,59 +94,6 @@ func init() {
9694
db.RegisterModel(new(TeamInvite))
9795
}
9896

99-
// SearchTeamOptions holds the search options
100-
type SearchTeamOptions struct {
101-
db.ListOptions
102-
UserID int64
103-
Keyword string
104-
OrgID int64
105-
IncludeDesc bool
106-
}
107-
108-
func (opts *SearchTeamOptions) toCond() builder.Cond {
109-
cond := builder.NewCond()
110-
111-
if len(opts.Keyword) > 0 {
112-
lowerKeyword := strings.ToLower(opts.Keyword)
113-
var keywordCond builder.Cond = builder.Like{"lower_name", lowerKeyword}
114-
if opts.IncludeDesc {
115-
keywordCond = keywordCond.Or(builder.Like{"LOWER(description)", lowerKeyword})
116-
}
117-
cond = cond.And(keywordCond)
118-
}
119-
120-
if opts.OrgID > 0 {
121-
cond = cond.And(builder.Eq{"`team`.org_id": opts.OrgID})
122-
}
123-
124-
if opts.UserID > 0 {
125-
cond = cond.And(builder.Eq{"team_user.uid": opts.UserID})
126-
}
127-
128-
return cond
129-
}
130-
131-
// SearchTeam search for teams. Caller is responsible to check permissions.
132-
func SearchTeam(opts *SearchTeamOptions) ([]*Team, int64, error) {
133-
sess := db.GetEngine(db.DefaultContext)
134-
135-
opts.SetDefaultValues()
136-
cond := opts.toCond()
137-
138-
if opts.UserID > 0 {
139-
sess = sess.Join("INNER", "team_user", "team_user.team_id = team.id")
140-
}
141-
sess = db.SetSessionPagination(sess, opts)
142-
143-
teams := make([]*Team, 0, opts.PageSize)
144-
count, err := sess.Where(cond).OrderBy("lower_name").FindAndCount(&teams)
145-
if err != nil {
146-
return nil, 0, err
147-
}
148-
149-
return teams, count, nil
150-
}
151-
15297
// ColorFormat provides a basic color format for a Team
15398
func (t *Team) ColorFormat(s fmt.State) {
15499
if t == nil {
@@ -335,16 +280,6 @@ func GetTeamNamesByID(teamIDs []int64) ([]string, error) {
335280
return teamNames, err
336281
}
337282

338-
// GetRepoTeams gets the list of teams that has access to the repository
339-
func GetRepoTeams(ctx context.Context, repo *repo_model.Repository) (teams []*Team, err error) {
340-
return teams, db.GetEngine(ctx).
341-
Join("INNER", "team_repo", "team_repo.team_id = team.id").
342-
Where("team.org_id = ?", repo.OwnerID).
343-
And("team_repo.repo_id=?", repo.ID).
344-
OrderBy("CASE WHEN name LIKE '" + OwnerTeamName + "' THEN '' ELSE name END").
345-
Find(&teams)
346-
}
347-
348283
// IncrTeamRepoNum increases the number of repos for the given team by 1
349284
func IncrTeamRepoNum(ctx context.Context, teamID int64) error {
350285
_, err := db.GetEngine(ctx).Incr("num_repos").ID(teamID).Update(new(Team))

0 commit comments

Comments
 (0)