Skip to content

Commit 2443d8f

Browse files
committed
Merge branch 'main' into lunny/add_migration_and_doctor_fix_repo_runners
2 parents febad27 + 84d2159 commit 2443d8f

Some content is hidden

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

82 files changed

+837
-710
lines changed

README.md

Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,64 @@ for the full license text.
150150
<details>
151151
<summary>Looking for an overview of the interface? Check it out!</summary>
152152

153-
|![Dashboard](https://dl.gitea.com/screenshots/home_timeline.png)|![User Profile](https://dl.gitea.com/screenshots/user_profile.png)|![Global Issues](https://dl.gitea.com/screenshots/global_issues.png)|
154-
|:---:|:---:|:---:|
155-
|![Branches](https://dl.gitea.com/screenshots/branches.png)|![Web Editor](https://dl.gitea.com/screenshots/web_editor.png)|![Activity](https://dl.gitea.com/screenshots/activity.png)|
156-
|![New Migration](https://dl.gitea.com/screenshots/migration.png)|![Migrating](https://dl.gitea.com/screenshots/migration.gif)|![Pull Request View](https://image.ibb.co/e02dSb/6.png)|
157-
|![Pull Request Dark](https://dl.gitea.com/screenshots/pull_requests_dark.png)|![Diff Review Dark](https://dl.gitea.com/screenshots/review_dark.png)|![Diff Dark](https://dl.gitea.com/screenshots/diff_dark.png)|
153+
### Login/Register Page
154+
155+
![Login](https://dl.gitea.com/screenshots/login.png)
156+
![Register](https://dl.gitea.com/screenshots/register.png)
157+
158+
### User Dashboard
159+
160+
![Home](https://dl.gitea.com/screenshots/home.png)
161+
![Issues](https://dl.gitea.com/screenshots/issues.png)
162+
![Pull Requests](https://dl.gitea.com/screenshots/pull_requests.png)
163+
![Milestones](https://dl.gitea.com/screenshots/milestones.png)
164+
165+
### User Profile
166+
167+
![Profile](https://dl.gitea.com/screenshots/user_profile.png)
168+
169+
### Explore
170+
171+
![Repos](https://dl.gitea.com/screenshots/explore_repos.png)
172+
![Users](https://dl.gitea.com/screenshots/explore_users.png)
173+
![Orgs](https://dl.gitea.com/screenshots/explore_orgs.png)
174+
175+
### Repository
176+
177+
![Home](https://dl.gitea.com/screenshots/repo_home.png)
178+
![Commits](https://dl.gitea.com/screenshots/repo_commits.png)
179+
![Branches](https://dl.gitea.com/screenshots/repo_branches.png)
180+
![Labels](https://dl.gitea.com/screenshots/repo_labels.png)
181+
![Milestones](https://dl.gitea.com/screenshots/repo_milestones.png)
182+
![Releases](https://dl.gitea.com/screenshots/repo_releases.png)
183+
![Tags](https://dl.gitea.com/screenshots/repo_tags.png)
184+
185+
#### Repository Issue
186+
187+
![List](https://dl.gitea.com/screenshots/repo_issues.png)
188+
![Issue](https://dl.gitea.com/screenshots/repo_issue.png)
189+
190+
#### Repository Pull Requests
191+
192+
![List](https://dl.gitea.com/screenshots/repo_pull_requests.png)
193+
![Pull Request](https://dl.gitea.com/screenshots/repo_pull_request.png)
194+
![File](https://dl.gitea.com/screenshots/repo_pull_request_file.png)
195+
![Commits](https://dl.gitea.com/screenshots/repo_pull_request_commits.png)
196+
197+
#### Repository Actions
198+
199+
![List](https://dl.gitea.com/screenshots/repo_actions.png)
200+
![Details](https://dl.gitea.com/screenshots/repo_actions_run.png)
201+
202+
#### Repository Activity
203+
204+
![Activity](https://dl.gitea.com/screenshots/repo_activity.png)
205+
![Contributors](https://dl.gitea.com/screenshots/repo_contributors.png)
206+
![Code Frequency](https://dl.gitea.com/screenshots/repo_code_frequency.png)
207+
![Recent Commits](https://dl.gitea.com/screenshots/repo_recent_commits.png)
208+
209+
### Organization
210+
211+
![Home](https://dl.gitea.com/screenshots/org_home.png)
158212

159213
</details>

README_ZH.md

Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,64 @@ Gitea 提供官方的 [go-sdk](https://gitea.com/gitea/go-sdk),以及名为 [t
9393
<details>
9494
<summary>截图</summary>
9595

96-
|![Dashboard](https://dl.gitea.com/screenshots/home_timeline.png)|![User Profile](https://dl.gitea.com/screenshots/user_profile.png)|![Global Issues](https://dl.gitea.com/screenshots/global_issues.png)|
97-
|:---:|:---:|:---:|
98-
|![Branches](https://dl.gitea.com/screenshots/branches.png)|![Web Editor](https://dl.gitea.com/screenshots/web_editor.png)|![Activity](https://dl.gitea.com/screenshots/activity.png)|
99-
|![New Migration](https://dl.gitea.com/screenshots/migration.png)|![Migrating](https://dl.gitea.com/screenshots/migration.gif)|![Pull Request View](https://image.ibb.co/e02dSb/6.png)|
100-
|![Pull Request Dark](https://dl.gitea.com/screenshots/pull_requests_dark.png)|![Diff Review Dark](https://dl.gitea.com/screenshots/review_dark.png)|![Diff Dark](https://dl.gitea.com/screenshots/diff_dark.png)|
96+
### 登录界面
97+
98+
![登录](https://dl.gitea.com/screenshots/login.png)
99+
![注册](https://dl.gitea.com/screenshots/register.png)
100+
101+
### 用户首页
102+
103+
![首页](https://dl.gitea.com/screenshots/home.png)
104+
![工单列表](https://dl.gitea.com/screenshots/issues.png)
105+
![合并请求列表](https://dl.gitea.com/screenshots/pull_requests.png)
106+
![里程碑列表](https://dl.gitea.com/screenshots/milestones.png)
107+
108+
### 用户资料
109+
110+
![用户资料](https://dl.gitea.com/screenshots/user_profile.png)
111+
112+
### 探索
113+
114+
![仓库列表](https://dl.gitea.com/screenshots/explore_repos.png)
115+
![用户列表](https://dl.gitea.com/screenshots/explore_users.png)
116+
![组织列表](https://dl.gitea.com/screenshots/explore_orgs.png)
117+
118+
### 仓库
119+
120+
![首页](https://dl.gitea.com/screenshots/repo_home.png)
121+
![提交列表](https://dl.gitea.com/screenshots/repo_commits.png)
122+
![分支列表](https://dl.gitea.com/screenshots/repo_branches.png)
123+
![标签列表](https://dl.gitea.com/screenshots/repo_labels.png)
124+
![里程碑列表](https://dl.gitea.com/screenshots/repo_milestones.png)
125+
![版本发布](https://dl.gitea.com/screenshots/repo_releases.png)
126+
![标签列表](https://dl.gitea.com/screenshots/repo_tags.png)
127+
128+
#### 仓库工单
129+
130+
![列表](https://dl.gitea.com/screenshots/repo_issues.png)
131+
![工单](https://dl.gitea.com/screenshots/repo_issue.png)
132+
133+
#### 仓库合并请求
134+
135+
![列表](https://dl.gitea.com/screenshots/repo_pull_requests.png)
136+
![合并请求](https://dl.gitea.com/screenshots/repo_pull_request.png)
137+
![文件](https://dl.gitea.com/screenshots/repo_pull_request_file.png)
138+
![提交列表](https://dl.gitea.com/screenshots/repo_pull_request_commits.png)
139+
140+
#### 仓库 Actions
141+
142+
![列表](https://dl.gitea.com/screenshots/repo_actions.png)
143+
![Run](https://dl.gitea.com/screenshots/repo_actions_run.png)
144+
145+
#### 仓库动态
146+
147+
![动态](https://dl.gitea.com/screenshots/repo_activity.png)
148+
![贡献者](https://dl.gitea.com/screenshots/repo_contributors.png)
149+
![代码频率](https://dl.gitea.com/screenshots/repo_code_frequency.png)
150+
![最近的提交](https://dl.gitea.com/screenshots/repo_recent_commits.png)
151+
152+
### 组织
153+
154+
![首页](https://dl.gitea.com/screenshots/org_home.png)
101155

102156
</details>

models/actions/run_list.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
repo_model "code.gitea.io/gitea/models/repo"
1111
user_model "code.gitea.io/gitea/models/user"
1212
"code.gitea.io/gitea/modules/container"
13+
"code.gitea.io/gitea/modules/translation"
1314
webhook_module "code.gitea.io/gitea/modules/webhook"
1415

1516
"xorm.io/builder"
@@ -112,14 +113,14 @@ type StatusInfo struct {
112113
}
113114

114115
// GetStatusInfoList returns a slice of StatusInfo
115-
func GetStatusInfoList(ctx context.Context) []StatusInfo {
116+
func GetStatusInfoList(ctx context.Context, lang translation.Locale) []StatusInfo {
116117
// same as those in aggregateJobStatus
117118
allStatus := []Status{StatusSuccess, StatusFailure, StatusWaiting, StatusRunning}
118119
statusInfoList := make([]StatusInfo, 0, 4)
119120
for _, s := range allStatus {
120121
statusInfoList = append(statusInfoList, StatusInfo{
121122
Status: int(s),
122-
DisplayedStatus: s.String(),
123+
DisplayedStatus: s.LocaleString(lang),
123124
})
124125
}
125126
return statusInfoList

modules/util/error.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,16 @@ import (
1010

1111
// Common Errors forming the base of our error system
1212
//
13-
// Many Errors returned by Gitea can be tested against these errors
14-
// using errors.Is.
13+
// Many Errors returned by Gitea can be tested against these errors using "errors.Is".
1514
var (
16-
ErrInvalidArgument = errors.New("invalid argument")
17-
ErrPermissionDenied = errors.New("permission denied")
18-
ErrAlreadyExist = errors.New("resource already exists")
19-
ErrNotExist = errors.New("resource does not exist")
15+
ErrInvalidArgument = errors.New("invalid argument") // also implies HTTP 400
16+
ErrPermissionDenied = errors.New("permission denied") // also implies HTTP 403
17+
ErrNotExist = errors.New("resource does not exist") // also implies HTTP 404
18+
ErrAlreadyExist = errors.New("resource already exists") // also implies HTTP 409
19+
20+
// ErrUnprocessableContent implies HTTP 422, syntax of the request content was correct,
21+
// but server was unable to process the contained instructions
22+
ErrUnprocessableContent = errors.New("unprocessable content")
2023
)
2124

2225
// SilentWrap provides a simple wrapper for a wrapped error where the wrapped error message plays no part in the error message

options/locale/locale_en-US.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,7 +1702,9 @@ issues.time_estimate_invalid = Time estimate format is invalid
17021702
issues.start_tracking_history = started working %s
17031703
issues.tracker_auto_close = Timer will be stopped automatically when this issue gets closed
17041704
issues.tracking_already_started = `You have already started time tracking on <a href="%s">another issue</a>!`
1705+
issues.stop_tracking = Stop Timer
17051706
issues.stop_tracking_history = worked for <b>%[1]s</b> %[2]s
1707+
issues.cancel_tracking = Discard
17061708
issues.cancel_tracking_history = `canceled time tracking %s`
17071709
issues.del_time = Delete this time log
17081710
issues.add_time_history = added spent time <b>%[1]s</b> %[2]s

routers/api/v1/admin/email.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func GetAllEmails(ctx *context.APIContext) {
4242
ListOptions: listOptions,
4343
})
4444
if err != nil {
45-
ctx.APIError(http.StatusInternalServerError, err)
45+
ctx.APIErrorInternal(err)
4646
return
4747
}
4848

routers/api/v1/admin/hooks.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ func ListHooks(ctx *context.APIContext) {
5959

6060
sysHooks, err := webhook.GetSystemOrDefaultWebhooks(ctx, isSystemWebhook)
6161
if err != nil {
62-
ctx.APIError(http.StatusInternalServerError, err)
62+
ctx.APIErrorInternal(err)
6363
return
6464
}
6565
hooks := make([]*api.Hook, len(sysHooks))
6666
for i, hook := range sysHooks {
6767
h, err := webhook_service.ToHook(setting.AppURL+"/-/admin", hook)
6868
if err != nil {
69-
ctx.APIError(http.StatusInternalServerError, err)
69+
ctx.APIErrorInternal(err)
7070
return
7171
}
7272
hooks[i] = h
@@ -98,13 +98,13 @@ func GetHook(ctx *context.APIContext) {
9898
if errors.Is(err, util.ErrNotExist) {
9999
ctx.APIErrorNotFound()
100100
} else {
101-
ctx.APIError(http.StatusInternalServerError, err)
101+
ctx.APIErrorInternal(err)
102102
}
103103
return
104104
}
105105
h, err := webhook_service.ToHook("/-/admin/", hook)
106106
if err != nil {
107-
ctx.APIError(http.StatusInternalServerError, err)
107+
ctx.APIErrorInternal(err)
108108
return
109109
}
110110
ctx.JSON(http.StatusOK, h)
@@ -188,7 +188,7 @@ func DeleteHook(ctx *context.APIContext) {
188188
if errors.Is(err, util.ErrNotExist) {
189189
ctx.APIErrorNotFound()
190190
} else {
191-
ctx.APIError(http.StatusInternalServerError, err)
191+
ctx.APIErrorInternal(err)
192192
}
193193
return
194194
}

routers/api/v1/admin/org.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func CreateOrg(ctx *context.APIContext) {
6969
db.IsErrNamePatternNotAllowed(err) {
7070
ctx.APIError(http.StatusUnprocessableEntity, err)
7171
} else {
72-
ctx.APIError(http.StatusInternalServerError, err)
72+
ctx.APIErrorInternal(err)
7373
}
7474
return
7575
}
@@ -109,7 +109,7 @@ func GetAllOrgs(ctx *context.APIContext) {
109109
Visible: []api.VisibleType{api.VisibleTypePublic, api.VisibleTypeLimited, api.VisibleTypePrivate},
110110
})
111111
if err != nil {
112-
ctx.APIError(http.StatusInternalServerError, err)
112+
ctx.APIErrorInternal(err)
113113
return
114114
}
115115
orgs := make([]*api.Organization, len(users))

routers/api/v1/admin/user.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func parseAuthSource(ctx *context.APIContext, u *user_model.User, sourceID int64
4242
if auth.IsErrSourceNotExist(err) {
4343
ctx.APIError(http.StatusUnprocessableEntity, err)
4444
} else {
45-
ctx.APIError(http.StatusInternalServerError, err)
45+
ctx.APIErrorInternal(err)
4646
}
4747
return
4848
}
@@ -145,7 +145,7 @@ func CreateUser(ctx *context.APIContext) {
145145
db.IsErrNamePatternNotAllowed(err) {
146146
ctx.APIError(http.StatusUnprocessableEntity, err)
147147
} else {
148-
ctx.APIError(http.StatusInternalServerError, err)
148+
ctx.APIErrorInternal(err)
149149
}
150150
return
151151
}
@@ -210,7 +210,7 @@ func EditUser(ctx *context.APIContext) {
210210
case errors.Is(err, password.ErrIsPwned), password.IsErrIsPwnedRequest(err):
211211
ctx.APIError(http.StatusBadRequest, err)
212212
default:
213-
ctx.APIError(http.StatusInternalServerError, err)
213+
ctx.APIErrorInternal(err)
214214
}
215215
return
216216
}
@@ -223,7 +223,7 @@ func EditUser(ctx *context.APIContext) {
223223
case user_model.IsErrEmailAlreadyUsed(err):
224224
ctx.APIError(http.StatusBadRequest, err)
225225
default:
226-
ctx.APIError(http.StatusInternalServerError, err)
226+
ctx.APIErrorInternal(err)
227227
}
228228
return
229229
}
@@ -252,7 +252,7 @@ func EditUser(ctx *context.APIContext) {
252252
if user_model.IsErrDeleteLastAdminUser(err) {
253253
ctx.APIError(http.StatusBadRequest, err)
254254
} else {
255-
ctx.APIError(http.StatusInternalServerError, err)
255+
ctx.APIErrorInternal(err)
256256
}
257257
return
258258
}
@@ -307,7 +307,7 @@ func DeleteUser(ctx *context.APIContext) {
307307
user_model.IsErrDeleteLastAdminUser(err) {
308308
ctx.APIError(http.StatusUnprocessableEntity, err)
309309
} else {
310-
ctx.APIError(http.StatusInternalServerError, err)
310+
ctx.APIErrorInternal(err)
311311
}
312312
return
313313
}
@@ -381,7 +381,7 @@ func DeleteUserPublicKey(ctx *context.APIContext) {
381381
} else if asymkey_model.IsErrKeyAccessDenied(err) {
382382
ctx.APIError(http.StatusForbidden, "You do not have access to this key")
383383
} else {
384-
ctx.APIError(http.StatusInternalServerError, err)
384+
ctx.APIErrorInternal(err)
385385
}
386386
return
387387
}
@@ -432,7 +432,7 @@ func SearchUsers(ctx *context.APIContext) {
432432
ListOptions: listOptions,
433433
})
434434
if err != nil {
435-
ctx.APIError(http.StatusInternalServerError, err)
435+
ctx.APIErrorInternal(err)
436436
return
437437
}
438438

routers/api/v1/admin/user_badge.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func ListUserBadges(ctx *context.APIContext) {
3333

3434
badges, maxResults, err := user_model.GetUserBadges(ctx, ctx.ContextUser)
3535
if err != nil {
36-
ctx.APIError(http.StatusInternalServerError, err)
36+
ctx.APIErrorInternal(err)
3737
return
3838
}
3939

@@ -70,7 +70,7 @@ func AddUserBadges(ctx *context.APIContext) {
7070
badges := prepareBadgesForReplaceOrAdd(*form)
7171

7272
if err := user_model.AddUserBadges(ctx, ctx.ContextUser, badges); err != nil {
73-
ctx.APIError(http.StatusInternalServerError, err)
73+
ctx.APIErrorInternal(err)
7474
return
7575
}
7676

@@ -106,7 +106,7 @@ func DeleteUserBadges(ctx *context.APIContext) {
106106
badges := prepareBadgesForReplaceOrAdd(*form)
107107

108108
if err := user_model.RemoveUserBadges(ctx, ctx.ContextUser, badges); err != nil {
109-
ctx.APIError(http.StatusInternalServerError, err)
109+
ctx.APIErrorInternal(err)
110110
return
111111
}
112112

0 commit comments

Comments
 (0)