Skip to content

Commit 3bd0e29

Browse files
authored
Merge branch 'main' into correct-tr
2 parents 831809d + a3d6850 commit 3bd0e29

Some content is hidden

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

42 files changed

+569
-560
lines changed

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,24 @@ 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.15.9](https://github.com/go-gitea/gitea/releases/tag/v1.15.9) - 2021-12-30
8+
9+
* BUGFIXES
10+
* Fix wrong redirect on org labels (#18128) (#18134)
11+
* Fix: unstable sort skips/duplicates issues across pages (#18094) (#18095)
12+
* Revert "Fix delete u2f keys bug (#18042)" (#18107)
13+
* Migrating wiki don't require token, so we should move it out of the require form (#17645) (#18104)
14+
* Prevent NPE if gitea uploader fails to open url (#18080) (#18101)
15+
* Reset locale on login (#17734) (#18100)
16+
* Correctly handle failed migrations (#17575) (#18099)
17+
* Instead of using routerCtx just escape the url before routing (#18086) (#18098)
18+
* Quote references to the user table in consistency checks (#18072) (#18073)
19+
* Add NotFound handler (#18062) (#18067)
20+
* Ensure that git repository is closed before transfer (#18049) (#18057)
21+
* Use common sessioner for API and web routes (#18114)
22+
* TRANSLATION
23+
* Fix code search result hint on zh-CN (#18053)
24+
725
## [1.15.8](https://github.com/go-gitea/gitea/releases/tag/v1.15.8) - 2021-12-20
826

927
* BUGFIXES

docs/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ params:
1818
description: Git with a cup of tea
1919
author: The Gitea Authors
2020
website: https://docs.gitea.io
21-
version: 1.15.8
21+
version: 1.15.9
2222
minGoVersion: 1.16
2323
goVersion: 1.17
2424
minNodeVersion: 12.17
Lines changed: 78 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,108 @@
11
---
22
date: "2016-12-01T16:00:00+02:00"
3-
title: "选择包安装"
3+
title: "使用包管理器安装"
44
slug: "install-from-package"
55
weight: 10
66
toc: false
77
draft: false
88
menu:
99
sidebar:
1010
parent: "installation"
11-
name: "选择包安装"
11+
name: "使用包管理器安装"
1212
weight: 20
1313
identifier: "install-from-package"
1414
---
1515

16-
# 使用包安装
16+
# 使用包管理器安装
1717

18-
## Linux
18+
**目录**
1919

20-
目前还没有对应的Linux安装包发布,如果我们发布了,我们将更新本页面。当前你可以查看 [从二进制安装]({{< relref "from-binary.zh-cn.md" >}})。
20+
{{< toc >}}
21+
22+
## Alpine Linux
23+
24+
Gitea 已经包含在 Alpine Linux 的[社区存储库](https://pkgs.alpinelinux.org/packages?name=gitea&branch=edge)中,版本与 Gitea 官方保持同步。
25+
26+
```sh
27+
apk add gitea
28+
```
29+
30+
## Arch Linux
31+
32+
Gitea 已经在滚动发布发行版的官方[社区存储库](https://www.archlinux.org/packages/community/x86_64/gitea/)中,版本与 Gitea 官方保持同步。
33+
34+
```sh
35+
pacman -S gitea
36+
```
37+
38+
## Arch Linux ARM
39+
40+
官方支持 [aarch64](https://archlinuxarm.org/packages/aarch64/gitea)[armv7h](https://archlinuxarm.org/packages/armv7h/gitea)[armv6h](https://archlinuxarm.org/packages/armv6h/gitea) 架构。
41+
42+
```sh
43+
pacman -S gitea
44+
```
45+
46+
## Canonical Snap
47+
48+
目前 Gitea 已在 Snap Store 中发布,名称为 [gitea](https://snapcraft.io/gitea)
49+
50+
```sh
51+
snap install gitea
52+
```
53+
54+
## SUSE/openSUSE
55+
56+
OpenSUSE 构建服务为 [openSUSE 和 SLE](https://software.opensuse.org/download/package?package=gitea&project=devel%3Atools%3Ascm)
57+
提供包,你可以在开发软件配置管理存储库中找到它们。
2158

2259
## Windows
2360

24-
目前还没有对应的Windows安装包发布,如果我们发布了,我们将更新本页面。我们计划使用 `MSI` 安装器或者 [Chocolatey](https://chocolatey.org/)来制作安装包。当前你可以查看 [从二进制安装]({{< relref "from-binary.zh-cn.md" >}})。
61+
目前你可以通过 [Chocolatey](https://chocolatey.org/) 来安装 [Gitea](https://chocolatey.org/packages/gitea)
62+
63+
```sh
64+
choco install gitea
65+
```
66+
67+
你也可以 [从二进制安装]({{< relref "from-binary.zh-cn.md" >}}) 。
2568

2669
## macOS
2770

28-
macOS 平台下当前我们仅支持通过 `brew` 来安装。如果您没有安装 [Homebrew](http://brew.sh/),你也可以查看 [从二进制安装]({{< relref "from-binary.zh-cn.md" >}})。在你安装了 `brew` 之后, 你可以执行以下命令:
71+
macOS 平台下当前我们仅支持通过 `brew` 来安装。如果你没有安装 [Homebrew](http://brew.sh/),你也可以查看 [从二进制安装]({{< relref "from-binary.zh-cn.md" >}})。在你安装了 `brew` 之后, 你可以执行以下命令:
2972

3073
```
3174
brew tap go-gitea/gitea
3275
brew install gitea
3376
```
3477

78+
## FreeBSD
79+
80+
可以使用 Gitea 的 FreeBSD port `www/gitea`。 请安装预构建的二进制包:
81+
82+
```
83+
pkg install gitea
84+
```
85+
86+
对于最新版本,或使用自定义选项构建 port,请
87+
[从 port 安装](https://www.freebsd.org/doc/handbook/ports-using.html)
88+
89+
```
90+
su -
91+
cd /usr/ports/www/gitea
92+
make install clean
93+
```
94+
95+
该 port 使用标准的 FreeBSD 文件系统布局:配置文件在 `/usr/local/etc/gitea` 目录中,
96+
模板、选项、插件和主题在 `/usr/local/share/gitea` 目录中,启动脚本在 `/usr/local/etc/rc.d/gitea` 目录中。
97+
98+
要使 Gitea 作为服务运行,请运行 `sysrc gitea_enable=YES` 并使用 `service gitea start` 命令启动它。
99+
100+
## 第三方
101+
102+
如果这里没有找到你喜欢的包管理器,可以使用 Gitea 第三方软件包。这里有一个完整的列表: [awesome-gitea](https://gitea.com/gitea/awesome-gitea/src/branch/master/README.md#user-content-packages)
103+
104+
如果你知道其他 Gitea 第三方软件包,请发送 PR 来添加它。
105+
35106
## 需要帮助?
36107

37108
如果从本页中没有找到你需要的内容,请访问 [帮助页面]({{< relref "seek-help.zh-cn.md" >}})

models/issue.go

Lines changed: 82 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,44 +1186,55 @@ type IssuesOptions struct {
11861186
// prioritize issues from this repo
11871187
PriorityRepoID int64
11881188
IsArchived util.OptionalBool
1189+
Org *Organization // issues permission scope
1190+
Team *Team // issues permission scope
1191+
User *user_model.User // issues permission scope
11891192
}
11901193

11911194
// sortIssuesSession sort an issues-related session based on the provided
11921195
// sortType string
11931196
func sortIssuesSession(sess *xorm.Session, sortType string, priorityRepoID int64) {
11941197
switch sortType {
11951198
case "oldest":
1196-
sess.Asc("issue.created_unix")
1199+
sess.Asc("issue.created_unix").Asc("issue.id")
11971200
case "recentupdate":
1198-
sess.Desc("issue.updated_unix")
1201+
sess.Desc("issue.updated_unix").Desc("issue.created_unix").Desc("issue.id")
11991202
case "leastupdate":
1200-
sess.Asc("issue.updated_unix")
1203+
sess.Asc("issue.updated_unix").Asc("issue.created_unix").Asc("issue.id")
12011204
case "mostcomment":
1202-
sess.Desc("issue.num_comments")
1205+
sess.Desc("issue.num_comments").Desc("issue.created_unix").Desc("issue.id")
12031206
case "leastcomment":
1204-
sess.Asc("issue.num_comments")
1207+
sess.Asc("issue.num_comments").Desc("issue.created_unix").Desc("issue.id")
12051208
case "priority":
1206-
sess.Desc("issue.priority")
1209+
sess.Desc("issue.priority").Desc("issue.created_unix").Desc("issue.id")
12071210
case "nearduedate":
12081211
// 253370764800 is 01/01/9999 @ 12:00am (UTC)
12091212
sess.Join("LEFT", "milestone", "issue.milestone_id = milestone.id").
12101213
OrderBy("CASE " +
12111214
"WHEN issue.deadline_unix = 0 AND (milestone.deadline_unix = 0 OR milestone.deadline_unix IS NULL) THEN 253370764800 " +
12121215
"WHEN milestone.deadline_unix = 0 OR milestone.deadline_unix IS NULL THEN issue.deadline_unix " +
12131216
"WHEN milestone.deadline_unix < issue.deadline_unix OR issue.deadline_unix = 0 THEN milestone.deadline_unix " +
1214-
"ELSE issue.deadline_unix END ASC")
1217+
"ELSE issue.deadline_unix END ASC").
1218+
Desc("issue.created_unix").
1219+
Desc("issue.id")
12151220
case "farduedate":
12161221
sess.Join("LEFT", "milestone", "issue.milestone_id = milestone.id").
12171222
OrderBy("CASE " +
12181223
"WHEN milestone.deadline_unix IS NULL THEN issue.deadline_unix " +
12191224
"WHEN milestone.deadline_unix < issue.deadline_unix OR issue.deadline_unix = 0 THEN milestone.deadline_unix " +
1220-
"ELSE issue.deadline_unix END DESC")
1225+
"ELSE issue.deadline_unix END DESC").
1226+
Desc("issue.created_unix").
1227+
Desc("issue.id")
12211228
case "priorityrepo":
1222-
sess.OrderBy("CASE WHEN issue.repo_id = " + strconv.FormatInt(priorityRepoID, 10) + " THEN 1 ELSE 2 END, issue.created_unix DESC")
1229+
sess.OrderBy("CASE " +
1230+
"WHEN issue.repo_id = " + strconv.FormatInt(priorityRepoID, 10) + " THEN 1 " +
1231+
"ELSE 2 END ASC").
1232+
Desc("issue.created_unix").
1233+
Desc("issue.id")
12231234
case "project-column-sorting":
1224-
sess.Asc("project_issue.sorting")
1235+
sess.Asc("project_issue.sorting").Desc("issue.created_unix").Desc("issue.id")
12251236
default:
1226-
sess.Desc("issue.created_unix")
1237+
sess.Desc("issue.created_unix").Desc("issue.id")
12271238
}
12281239
}
12291240

@@ -1329,6 +1340,44 @@ func (opts *IssuesOptions) setupSession(sess *xorm.Session) {
13291340
From("milestone").
13301341
Where(builder.In("name", opts.IncludeMilestones)))
13311342
}
1343+
1344+
if opts.User != nil {
1345+
sess.And(
1346+
issuePullAccessibleRepoCond("issue.repo_id", opts.User.ID, opts.Org, opts.Team, opts.IsPull.IsTrue()),
1347+
)
1348+
}
1349+
}
1350+
1351+
// issuePullAccessibleRepoCond userID must not be zero, this condition require join repository table
1352+
func issuePullAccessibleRepoCond(repoIDstr string, userID int64, org *Organization, team *Team, isPull bool) builder.Cond {
1353+
var cond = builder.NewCond()
1354+
var unitType = unit.TypeIssues
1355+
if isPull {
1356+
unitType = unit.TypePullRequests
1357+
}
1358+
if org != nil {
1359+
if team != nil {
1360+
cond = cond.And(teamUnitsRepoCond(repoIDstr, userID, org.ID, team.ID, unitType)) // special team member repos
1361+
} else {
1362+
cond = cond.And(
1363+
builder.Or(
1364+
userOrgUnitRepoCond(repoIDstr, userID, org.ID, unitType), // team member repos
1365+
userOrgPublicUnitRepoCond(userID, org.ID), // user org public non-member repos, TODO: check repo has issues
1366+
),
1367+
)
1368+
}
1369+
} else {
1370+
cond = cond.And(
1371+
builder.Or(
1372+
userOwnedRepoCond(userID), // owned repos
1373+
userCollaborationRepoCond(repoIDstr, userID), // collaboration repos
1374+
userAssignedRepoCond(repoIDstr, userID), // user has been assigned accessible public repos
1375+
userMentionedRepoCond(repoIDstr, userID), // user has been mentioned accessible public repos
1376+
userCreateIssueRepoCond(repoIDstr, userID, isPull), // user has created issue/pr accessible public repos
1377+
),
1378+
)
1379+
}
1380+
return cond
13321381
}
13331382

13341383
func applyReposCondition(sess *xorm.Session, repoIDs []int64) *xorm.Session {
@@ -1638,15 +1687,16 @@ func getIssueStatsChunk(opts *IssueStatsOptions, issueIDs []int64) (*IssueStats,
16381687

16391688
// UserIssueStatsOptions contains parameters accepted by GetUserIssueStats.
16401689
type UserIssueStatsOptions struct {
1641-
UserID int64
1642-
RepoIDs []int64
1643-
UserRepoIDs []int64
1644-
FilterMode int
1645-
IsPull bool
1646-
IsClosed bool
1647-
IssueIDs []int64
1648-
IsArchived util.OptionalBool
1649-
LabelIDs []int64
1690+
UserID int64
1691+
RepoIDs []int64
1692+
FilterMode int
1693+
IsPull bool
1694+
IsClosed bool
1695+
IssueIDs []int64
1696+
IsArchived util.OptionalBool
1697+
LabelIDs []int64
1698+
Org *Organization
1699+
Team *Team
16501700
}
16511701

16521702
// GetUserIssueStats returns issue statistic information for dashboard by given conditions.
@@ -1663,28 +1713,34 @@ func GetUserIssueStats(opts UserIssueStatsOptions) (*IssueStats, error) {
16631713
cond = cond.And(builder.In("issue.id", opts.IssueIDs))
16641714
}
16651715

1716+
if opts.UserID > 0 {
1717+
cond = cond.And(issuePullAccessibleRepoCond("issue.repo_id", opts.UserID, opts.Org, opts.Team, opts.IsPull))
1718+
}
1719+
16661720
sess := func(cond builder.Cond) *xorm.Session {
16671721
s := db.GetEngine(db.DefaultContext).Where(cond)
16681722
if len(opts.LabelIDs) > 0 {
16691723
s.Join("INNER", "issue_label", "issue_label.issue_id = issue.id").
16701724
In("issue_label.label_id", opts.LabelIDs)
16711725
}
1672-
if opts.IsArchived != util.OptionalBoolNone {
1673-
s.Join("INNER", "repository", "issue.repo_id = repository.id").
1674-
And(builder.Eq{"repository.is_archived": opts.IsArchived.IsTrue()})
1726+
if opts.UserID > 0 || opts.IsArchived != util.OptionalBoolNone {
1727+
s.Join("INNER", "repository", "issue.repo_id = repository.id")
1728+
if opts.IsArchived != util.OptionalBoolNone {
1729+
s.And(builder.Eq{"repository.is_archived": opts.IsArchived.IsTrue()})
1730+
}
16751731
}
16761732
return s
16771733
}
16781734

16791735
switch opts.FilterMode {
16801736
case FilterModeAll:
1681-
stats.OpenCount, err = applyReposCondition(sess(cond), opts.UserRepoIDs).
1737+
stats.OpenCount, err = sess(cond).
16821738
And("issue.is_closed = ?", false).
16831739
Count(new(Issue))
16841740
if err != nil {
16851741
return nil, err
16861742
}
1687-
stats.ClosedCount, err = applyReposCondition(sess(cond), opts.UserRepoIDs).
1743+
stats.ClosedCount, err = sess(cond).
16881744
And("issue.is_closed = ?", true).
16891745
Count(new(Issue))
16901746
if err != nil {
@@ -1760,7 +1816,7 @@ func GetUserIssueStats(opts UserIssueStatsOptions) (*IssueStats, error) {
17601816
return nil, err
17611817
}
17621818

1763-
stats.YourRepositoriesCount, err = applyReposCondition(sess(cond), opts.UserRepoIDs).Count(new(Issue))
1819+
stats.YourRepositoriesCount, err = sess(cond).Count(new(Issue))
17641820
if err != nil {
17651821
return nil, err
17661822
}

models/issue_list.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ const (
2525
func (issues IssueList) getRepoIDs() []int64 {
2626
repoIDs := make(map[int64]struct{}, len(issues))
2727
for _, issue := range issues {
28+
if issue.Repo != nil {
29+
continue
30+
}
2831
if _, ok := repoIDs[issue.RepoID]; !ok {
2932
repoIDs[issue.RepoID] = struct{}{}
3033
}
@@ -56,8 +59,12 @@ func (issues IssueList) loadRepositories(e db.Engine) ([]*repo_model.Repository,
5659
}
5760

5861
for _, issue := range issues {
59-
issue.Repo = repoMaps[issue.RepoID]
60-
if issue.PullRequest != nil {
62+
if issue.Repo == nil {
63+
issue.Repo = repoMaps[issue.RepoID]
64+
} else {
65+
repoMaps[issue.RepoID] = issue.Repo
66+
}
67+
if issue.PullRequest != nil && issue.PullRequest.BaseRepo == nil {
6168
issue.PullRequest.BaseRepo = issue.Repo
6269
}
6370
}

0 commit comments

Comments
 (0)