Skip to content

Commit baea445

Browse files
committed
Merge remote-tracking branch 'upstream/main'
* upstream/main: (26 commits) Add 'Show on a map' button to Location in profile, fix layout (go-gitea#26214) Use shared template for webhook icons (go-gitea#26242) Reduce margins on user settings page, introduce `flex-container` (go-gitea#26046) Refactor and enhance issue indexer to support both searching, filtering and paging (go-gitea#26012) Show image size on view page (go-gitea#25884) Fix pull request check list is limited (go-gitea#26179) Fix API leaking Usermail if not logged in (go-gitea#25097) [skip ci] Updated licenses and gitignores Fix typo in metadata (go-gitea#26207) Update js and py dependencies (go-gitea#26243) De-emphasize issue sidebar buttons (go-gitea#26171) Don't autosize textarea in diff view (go-gitea#26233) Add `/public/assets` to `.ignore` (go-gitea#26232) Fix attachment clipboard copy on insecure origin (go-gitea#26224) Fix commit compare style (go-gitea#26209) Fix unable to display individual-level project (go-gitea#26198) Fix access check for org-level project (go-gitea#26182) Fixed incorrect locale references (go-gitea#26218) Use calendar icon for `Joined on...` in profiles (go-gitea#26215) Add changelog for 1.20.2 (go-gitea#26208) ...
2 parents 086bf7c + d58c542 commit baea445

File tree

172 files changed

+4469
-1832
lines changed

Some content is hidden

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

172 files changed

+4469
-1832
lines changed

.eslintrc.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,6 @@ rules:
422422
no-restricted-imports: [0]
423423
no-restricted-syntax: [2, WithStatement, ForInStatement, LabeledStatement, SequenceExpression]
424424
no-return-assign: [0]
425-
no-return-await: [0]
426425
no-script-url: [2]
427426
no-self-assign: [2, {props: true}]
428427
no-self-compare: [2]

.github/workflows/pull-db-tests.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ jobs:
9898
discovery.type: single-node
9999
ports:
100100
- "9200:9200"
101+
meilisearch:
102+
image: getmeili/meilisearch:v1.2.0
103+
env:
104+
MEILI_ENV: development # disable auth
105+
ports:
106+
- "7700:7700"
101107
smtpimap:
102108
image: tabascoterrier/docker-imap-devel:latest
103109
ports:
@@ -128,7 +134,7 @@ jobs:
128134
go-version: ">=1.20"
129135
check-latest: true
130136
- name: Add hosts to /etc/hosts
131-
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts'
137+
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql elasticsearch meilisearch smtpimap" | sudo tee -a /etc/hosts'
132138
- run: make deps-backend
133139
- run: make backend
134140
env:

.ignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
/modules/public/bindata.go
66
/modules/templates/bindata.go
77
/vendor
8+
/public/assets
89
node_modules

CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,34 @@ 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.20.2](https://github.com/go-gitea/gitea/releases/tag/1.20.2) - 2023-07-29
8+
9+
* ENHANCEMENTS
10+
* Calculate MAX_WORKERS default value by CPU number (#26177) (#26183)
11+
* Display deprecated warning in admin panel pages as well as in the log file (#26094) (#26154)
12+
* BUGFIXES
13+
* Fix allowed user types setting problem (#26200) (#26206)
14+
* Fix handling of plenty Nuget package versions (#26075) (#26173)
15+
* Fix UI regression of asciinema player (#26159) (#26162)
16+
* Fix LFS object list style (#26133) (#26147)
17+
* Fix allowed user types setting problem (#26200) (#26206)
18+
* Prevent primary key update on migration (#26192) (#26199)
19+
* Fix bug when pushing to a pull request which enabled dismiss approval automatically (#25882) (#26158)
20+
* Fix bugs in LFS meta garbage collection (#26122) (#26157)
21+
* Update xorm version (#26128) (#26150)
22+
* Remove "misc" scope check from public API endpoints (#26134) (#26149)
23+
* Fix CLI allowing creation of access tokens with existing name (#26071) (#26144)
24+
* Fix incorrect router logger (#26137) (#26143)
25+
* Improve commit graph alignment and truncating (#26112) (#26127)
26+
* Avoid writing config file if not installed (#26107) (#26113)
27+
* Fix escape problems in the branch selector (#25875) (#26103)
28+
* Fix handling of Debian files with trailing slash (#26087) (#26098)
29+
* Fix Missing 404 swagger response docs for /admin/users/{username} (#26086) (#26089)
30+
* Use stderr as fallback if the log file can't be opened (#26074) (#26083)
31+
* Increase table cell horizontal padding (#26140) (#26142)
32+
* Fix wrong workflow status when rerun a job in an already finished workflow (#26119) (#26124)
33+
* Fix duplicated url prefix on issue context menu (#26066) (#26067)
34+
735
## [1.20.1](https://github.com/go-gitea/gitea/releases/tag/1.20.1) - 2023-07-22
836

937
* SECURITY

custom/conf/app.example.ini

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,15 @@ LEVEL = Info
827827
;; Dependencies can be added from any repository where the user is granted access or only from the current repository depending on this setting.
828828
;ALLOW_CROSS_REPOSITORY_DEPENDENCIES = true
829829
;;
830+
;; Default map service. No external API support has been included. A service has to allow
831+
;; searching using URL parameters, the location will be appended to the URL as escaped query parameter.
832+
;; Disabled by default, some example values are:
833+
;; - OpenStreetMap: https://www.openstreetmap.org/search?query=
834+
;; - Google Maps: https://www.google.com/maps/place/
835+
;; - MapQuest: https://www.mapquest.com/search/
836+
;; - Bing Maps: https://www.bing.com/maps?where1=
837+
; USER_LOCATION_MAP_URL =
838+
;;
830839
;; Enable heatmap on users profiles.
831840
;ENABLE_USER_HEATMAP = true
832841
;;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,7 @@ And the following unique queues:
648648
- `DEFAULT_USER_IS_RESTRICTED`: **false**: Give new users restricted permissions by default
649649
- `DEFAULT_ENABLE_DEPENDENCIES`: **true**: Enable this to have dependencies enabled by default.
650650
- `ALLOW_CROSS_REPOSITORY_DEPENDENCIES` : **true** Enable this to allow dependencies on issues from any repository where the user is granted access.
651+
- `USER_LOCATION_MAP_URL`: **""**: A map service URL to show user's location on a map. The location will be appended to the URL as escaped query parameter.
651652
- `ENABLE_USER_HEATMAP`: **true**: Enable this to display the heatmap on users profiles.
652653
- `ENABLE_TIMETRACKING`: **true**: Enable Timetracking feature.
653654
- `DEFAULT_ENABLE_TIMETRACKING`: **true**: Allow repositories to use timetracking by default.

models/db/common.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,20 @@ func BuildCaseInsensitiveLike(key, value string) builder.Cond {
2020
}
2121
return builder.Like{"UPPER(" + key + ")", strings.ToUpper(value)}
2222
}
23+
24+
// BuildCaseInsensitiveIn returns a condition to check if the given value is in the given values case-insensitively.
25+
// Handles especially SQLite correctly as UPPER there only transforms ASCII letters.
26+
func BuildCaseInsensitiveIn(key string, values []string) builder.Cond {
27+
uppers := make([]string, 0, len(values))
28+
if setting.Database.Type.IsSQLite3() {
29+
for _, value := range values {
30+
uppers = append(uppers, util.ToUpperASCII(value))
31+
}
32+
} else {
33+
for _, value := range values {
34+
uppers = append(uppers, strings.ToUpper(value))
35+
}
36+
}
37+
38+
return builder.In("UPPER("+key+")", uppers)
39+
}

models/fixtures/issue.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,3 +304,20 @@
304304
created_unix: 946684830
305305
updated_unix: 978307200
306306
is_locked: false
307+
308+
-
309+
id: 19
310+
repo_id: 58
311+
index: 1
312+
poster_id: 2
313+
original_author_id: 0
314+
name: issue for pr
315+
content: content
316+
milestone_id: 0
317+
priority: 0
318+
is_closed: false
319+
is_pull: true
320+
num_comments: 0
321+
created_unix: 946684830
322+
updated_unix: 978307200
323+
is_locked: false

models/fixtures/pull_request.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,16 @@
7676
base_branch: master
7777
merge_base: 2a47ca4b614a9f5a
7878
has_merged: false
79+
80+
-
81+
id: 7
82+
type: 0 # gitea pull request
83+
status: 2 # mergable
84+
issue_id: 19
85+
index: 1
86+
head_repo_id: 58
87+
base_repo_id: 58
88+
head_branch: branch1
89+
base_branch: main
90+
merge_base: cbff181af4c9c7fee3cf6c106699e07d9a3f54e6
91+
has_merged: false

models/fixtures/repo_unit.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,3 +607,33 @@
607607
repo_id: 52
608608
type: 1
609609
created_unix: 946684810
610+
611+
-
612+
id: 91
613+
repo_id: 58
614+
type: 1
615+
created_unix: 946684810
616+
617+
-
618+
id: 92
619+
repo_id: 58
620+
type: 2
621+
created_unix: 946684810
622+
623+
-
624+
id: 93
625+
repo_id: 58
626+
type: 3
627+
created_unix: 946684810
628+
629+
-
630+
id: 94
631+
repo_id: 58
632+
type: 4
633+
created_unix: 946684810
634+
635+
-
636+
id: 95
637+
repo_id: 58
638+
type: 5
639+
created_unix: 946684810

models/fixtures/repository.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1662,3 +1662,34 @@
16621662
is_private: false
16631663
status: 0
16641664
num_issues: 0
1665+
1666+
-
1667+
id: 58 # org public repo
1668+
owner_id: 2
1669+
owner_name: user2
1670+
lower_name: commitsonpr
1671+
name: commitsonpr
1672+
default_branch: main
1673+
num_watches: 0
1674+
num_stars: 0
1675+
num_forks: 0
1676+
num_issues: 0
1677+
num_closed_issues: 0
1678+
num_pulls: 1
1679+
num_closed_pulls: 0
1680+
num_milestones: 0
1681+
num_closed_milestones: 0
1682+
num_projects: 0
1683+
num_closed_projects: 0
1684+
is_private: false
1685+
is_empty: false
1686+
is_archived: false
1687+
is_mirror: false
1688+
status: 0
1689+
is_fork: false
1690+
fork_id: 0
1691+
is_template: false
1692+
template_id: 0
1693+
size: 0
1694+
is_fsck_enabled: true
1695+
close_issues_via_commit_in_any_branch: false

models/fixtures/team_unit.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,3 +280,9 @@
280280
team_id: 20
281281
type: 9 # package
282282
access_mode: 2
283+
284+
-
285+
id: 48
286+
team_id: 2
287+
type: 8
288+
access_mode: 2

models/fixtures/user.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
num_followers: 2
6767
num_following: 1
6868
num_stars: 2
69-
num_repos: 13
69+
num_repos: 14
7070
num_teams: 0
7171
num_members: 0
7272
visibility: 0

models/git/commit_status.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,9 @@ func GetLatestCommitStatus(ctx context.Context, repoID int64, sha string, listOp
283283
Where("repo_id = ?", repoID).And("sha = ?", sha).
284284
Select("max( id ) as id").
285285
GroupBy("context_hash").OrderBy("max( id ) desc")
286-
287-
sess = db.SetSessionPagination(sess, &listOptions)
288-
286+
if !listOptions.IsListAll() {
287+
sess = db.SetSessionPagination(sess, &listOptions)
288+
}
289289
count, err := sess.FindAndCount(&ids)
290290
if err != nil {
291291
return nil, count, err

models/issues/issue.go

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
project_model "code.gitea.io/gitea/models/project"
1414
repo_model "code.gitea.io/gitea/models/repo"
1515
user_model "code.gitea.io/gitea/models/user"
16+
"code.gitea.io/gitea/modules/container"
1617
"code.gitea.io/gitea/modules/log"
1718
"code.gitea.io/gitea/modules/setting"
1819
api "code.gitea.io/gitea/modules/structs"
@@ -550,9 +551,30 @@ func GetIssueWithAttrsByID(id int64) (*Issue, error) {
550551
}
551552

552553
// GetIssuesByIDs return issues with the given IDs.
553-
func GetIssuesByIDs(ctx context.Context, issueIDs []int64) (IssueList, error) {
554+
// If keepOrder is true, the order of the returned issues will be the same as the given IDs.
555+
func GetIssuesByIDs(ctx context.Context, issueIDs []int64, keepOrder ...bool) (IssueList, error) {
554556
issues := make([]*Issue, 0, len(issueIDs))
555-
return issues, db.GetEngine(ctx).In("id", issueIDs).Find(&issues)
557+
558+
if err := db.GetEngine(ctx).In("id", issueIDs).Find(&issues); err != nil {
559+
return nil, err
560+
}
561+
562+
if len(keepOrder) > 0 && keepOrder[0] {
563+
m := make(map[int64]*Issue, len(issues))
564+
appended := container.Set[int64]{}
565+
for _, issue := range issues {
566+
m[issue.ID] = issue
567+
}
568+
issues = issues[:0]
569+
for _, id := range issueIDs {
570+
if issue, ok := m[id]; ok && !appended.Contains(id) { // make sure the id is existed and not appended
571+
appended.Add(id)
572+
issues = append(issues, issue)
573+
}
574+
}
575+
}
576+
577+
return issues, nil
556578
}
557579

558580
// GetIssueIDsByRepoID returns all issue ids by repo id

0 commit comments

Comments
 (0)