Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
* 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)
  ...
  • Loading branch information
zjjhot committed Jul 31, 2023
2 parents 086bf7c + d58c542 commit baea445
Show file tree
Hide file tree
Showing 172 changed files with 4,469 additions and 1,832 deletions.
1 change: 0 additions & 1 deletion .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,6 @@ rules:
no-restricted-imports: [0]
no-restricted-syntax: [2, WithStatement, ForInStatement, LabeledStatement, SequenceExpression]
no-return-assign: [0]
no-return-await: [0]
no-script-url: [2]
no-self-assign: [2, {props: true}]
no-self-compare: [2]
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/pull-db-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ jobs:
discovery.type: single-node
ports:
- "9200:9200"
meilisearch:
image: getmeili/meilisearch:v1.2.0
env:
MEILI_ENV: development # disable auth
ports:
- "7700:7700"
smtpimap:
image: tabascoterrier/docker-imap-devel:latest
ports:
Expand Down Expand Up @@ -128,7 +134,7 @@ jobs:
go-version: ">=1.20"
check-latest: true
- name: Add hosts to /etc/hosts
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts'
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql elasticsearch meilisearch smtpimap" | sudo tee -a /etc/hosts'
- run: make deps-backend
- run: make backend
env:
Expand Down
1 change: 1 addition & 0 deletions .ignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
/modules/public/bindata.go
/modules/templates/bindata.go
/vendor
/public/assets
node_modules
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,34 @@ This changelog goes through all the changes that have been made in each release
without substantial changes to our git log; to see the highlights of what has
been added to each release, please refer to the [blog](https://blog.gitea.io).

## [1.20.2](https://github.com/go-gitea/gitea/releases/tag/1.20.2) - 2023-07-29

* ENHANCEMENTS
* Calculate MAX_WORKERS default value by CPU number (#26177) (#26183)
* Display deprecated warning in admin panel pages as well as in the log file (#26094) (#26154)
* BUGFIXES
* Fix allowed user types setting problem (#26200) (#26206)
* Fix handling of plenty Nuget package versions (#26075) (#26173)
* Fix UI regression of asciinema player (#26159) (#26162)
* Fix LFS object list style (#26133) (#26147)
* Fix allowed user types setting problem (#26200) (#26206)
* Prevent primary key update on migration (#26192) (#26199)
* Fix bug when pushing to a pull request which enabled dismiss approval automatically (#25882) (#26158)
* Fix bugs in LFS meta garbage collection (#26122) (#26157)
* Update xorm version (#26128) (#26150)
* Remove "misc" scope check from public API endpoints (#26134) (#26149)
* Fix CLI allowing creation of access tokens with existing name (#26071) (#26144)
* Fix incorrect router logger (#26137) (#26143)
* Improve commit graph alignment and truncating (#26112) (#26127)
* Avoid writing config file if not installed (#26107) (#26113)
* Fix escape problems in the branch selector (#25875) (#26103)
* Fix handling of Debian files with trailing slash (#26087) (#26098)
* Fix Missing 404 swagger response docs for /admin/users/{username} (#26086) (#26089)
* Use stderr as fallback if the log file can't be opened (#26074) (#26083)
* Increase table cell horizontal padding (#26140) (#26142)
* Fix wrong workflow status when rerun a job in an already finished workflow (#26119) (#26124)
* Fix duplicated url prefix on issue context menu (#26066) (#26067)

## [1.20.1](https://github.com/go-gitea/gitea/releases/tag/1.20.1) - 2023-07-22

* SECURITY
Expand Down
9 changes: 9 additions & 0 deletions custom/conf/app.example.ini
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,15 @@ LEVEL = Info
;; Dependencies can be added from any repository where the user is granted access or only from the current repository depending on this setting.
;ALLOW_CROSS_REPOSITORY_DEPENDENCIES = true
;;
;; Default map service. No external API support has been included. A service has to allow
;; searching using URL parameters, the location will be appended to the URL as escaped query parameter.
;; Disabled by default, some example values are:
;; - OpenStreetMap: https://www.openstreetmap.org/search?query=
;; - Google Maps: https://www.google.com/maps/place/
;; - MapQuest: https://www.mapquest.com/search/
;; - Bing Maps: https://www.bing.com/maps?where1=
; USER_LOCATION_MAP_URL =
;;
;; Enable heatmap on users profiles.
;ENABLE_USER_HEATMAP = true
;;
Expand Down
1 change: 1 addition & 0 deletions docs/content/administration/config-cheat-sheet.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,7 @@ And the following unique queues:
- `DEFAULT_USER_IS_RESTRICTED`: **false**: Give new users restricted permissions by default
- `DEFAULT_ENABLE_DEPENDENCIES`: **true**: Enable this to have dependencies enabled by default.
- `ALLOW_CROSS_REPOSITORY_DEPENDENCIES` : **true** Enable this to allow dependencies on issues from any repository where the user is granted access.
- `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.
- `ENABLE_USER_HEATMAP`: **true**: Enable this to display the heatmap on users profiles.
- `ENABLE_TIMETRACKING`: **true**: Enable Timetracking feature.
- `DEFAULT_ENABLE_TIMETRACKING`: **true**: Allow repositories to use timetracking by default.
Expand Down
17 changes: 17 additions & 0 deletions models/db/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,20 @@ func BuildCaseInsensitiveLike(key, value string) builder.Cond {
}
return builder.Like{"UPPER(" + key + ")", strings.ToUpper(value)}
}

// BuildCaseInsensitiveIn returns a condition to check if the given value is in the given values case-insensitively.
// Handles especially SQLite correctly as UPPER there only transforms ASCII letters.
func BuildCaseInsensitiveIn(key string, values []string) builder.Cond {
uppers := make([]string, 0, len(values))
if setting.Database.Type.IsSQLite3() {
for _, value := range values {
uppers = append(uppers, util.ToUpperASCII(value))
}
} else {
for _, value := range values {
uppers = append(uppers, strings.ToUpper(value))
}
}

return builder.In("UPPER("+key+")", uppers)
}
17 changes: 17 additions & 0 deletions models/fixtures/issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -304,3 +304,20 @@
created_unix: 946684830
updated_unix: 978307200
is_locked: false

-
id: 19
repo_id: 58
index: 1
poster_id: 2
original_author_id: 0
name: issue for pr
content: content
milestone_id: 0
priority: 0
is_closed: false
is_pull: true
num_comments: 0
created_unix: 946684830
updated_unix: 978307200
is_locked: false
13 changes: 13 additions & 0 deletions models/fixtures/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,16 @@
base_branch: master
merge_base: 2a47ca4b614a9f5a
has_merged: false

-
id: 7
type: 0 # gitea pull request
status: 2 # mergable
issue_id: 19
index: 1
head_repo_id: 58
base_repo_id: 58
head_branch: branch1
base_branch: main
merge_base: cbff181af4c9c7fee3cf6c106699e07d9a3f54e6
has_merged: false
30 changes: 30 additions & 0 deletions models/fixtures/repo_unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -607,3 +607,33 @@
repo_id: 52
type: 1
created_unix: 946684810

-
id: 91
repo_id: 58
type: 1
created_unix: 946684810

-
id: 92
repo_id: 58
type: 2
created_unix: 946684810

-
id: 93
repo_id: 58
type: 3
created_unix: 946684810

-
id: 94
repo_id: 58
type: 4
created_unix: 946684810

-
id: 95
repo_id: 58
type: 5
created_unix: 946684810
31 changes: 31 additions & 0 deletions models/fixtures/repository.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1662,3 +1662,34 @@
is_private: false
status: 0
num_issues: 0

-
id: 58 # org public repo
owner_id: 2
owner_name: user2
lower_name: commitsonpr
name: commitsonpr
default_branch: main
num_watches: 0
num_stars: 0
num_forks: 0
num_issues: 0
num_closed_issues: 0
num_pulls: 1
num_closed_pulls: 0
num_milestones: 0
num_closed_milestones: 0
num_projects: 0
num_closed_projects: 0
is_private: false
is_empty: false
is_archived: false
is_mirror: false
status: 0
is_fork: false
fork_id: 0
is_template: false
template_id: 0
size: 0
is_fsck_enabled: true
close_issues_via_commit_in_any_branch: false
6 changes: 6 additions & 0 deletions models/fixtures/team_unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -280,3 +280,9 @@
team_id: 20
type: 9 # package
access_mode: 2

-
id: 48
team_id: 2
type: 8
access_mode: 2
2 changes: 1 addition & 1 deletion models/fixtures/user.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
num_followers: 2
num_following: 1
num_stars: 2
num_repos: 13
num_repos: 14
num_teams: 0
num_members: 0
visibility: 0
Expand Down
6 changes: 3 additions & 3 deletions models/git/commit_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,9 @@ func GetLatestCommitStatus(ctx context.Context, repoID int64, sha string, listOp
Where("repo_id = ?", repoID).And("sha = ?", sha).
Select("max( id ) as id").
GroupBy("context_hash").OrderBy("max( id ) desc")

sess = db.SetSessionPagination(sess, &listOptions)

if !listOptions.IsListAll() {
sess = db.SetSessionPagination(sess, &listOptions)
}
count, err := sess.FindAndCount(&ids)
if err != nil {
return nil, count, err
Expand Down
26 changes: 24 additions & 2 deletions models/issues/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
project_model "code.gitea.io/gitea/models/project"
repo_model "code.gitea.io/gitea/models/repo"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/container"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
Expand Down Expand Up @@ -550,9 +551,30 @@ func GetIssueWithAttrsByID(id int64) (*Issue, error) {
}

// GetIssuesByIDs return issues with the given IDs.
func GetIssuesByIDs(ctx context.Context, issueIDs []int64) (IssueList, error) {
// If keepOrder is true, the order of the returned issues will be the same as the given IDs.
func GetIssuesByIDs(ctx context.Context, issueIDs []int64, keepOrder ...bool) (IssueList, error) {
issues := make([]*Issue, 0, len(issueIDs))
return issues, db.GetEngine(ctx).In("id", issueIDs).Find(&issues)

if err := db.GetEngine(ctx).In("id", issueIDs).Find(&issues); err != nil {
return nil, err
}

if len(keepOrder) > 0 && keepOrder[0] {
m := make(map[int64]*Issue, len(issues))
appended := container.Set[int64]{}
for _, issue := range issues {
m[issue.ID] = issue
}
issues = issues[:0]
for _, id := range issueIDs {
if issue, ok := m[id]; ok && !appended.Contains(id) { // make sure the id is existed and not appended
appended.Add(id)
issues = append(issues, issue)
}
}
}

return issues, nil
}

// GetIssueIDsByRepoID returns all issue ids by repo id
Expand Down
Loading

0 comments on commit baea445

Please sign in to comment.