Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f9c788c

Browse files
authoredApr 1, 2023
Merge branch 'main' into improve-action-log-line
2 parents 2604c22 + 053df15 commit f9c788c

File tree

30 files changed

+182
-114
lines changed

30 files changed

+182
-114
lines changed
 

‎build/update-locales.sh

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,10 @@ fi
1717

1818
mv ./options/locale/locale_en-US.ini ./options/
1919

20-
# the "ini" library for locale has many quirks
21-
# * `a="xx"` gets `xx` (no quote)
22-
# * `a=x\"y` gets `x\"y` (no unescaping)
23-
# * `a="x\"y"` gets `"x\"y"` (no unescaping, the quotes are still there)
24-
# * `a='x\"y'` gets `x\"y` (no unescaping, no quote)
25-
# * `a="foo` gets `"foo` (although the quote is not closed)
26-
# * 'a=`foo`' works like single-quote
27-
# crowdin needs the strings to be quoted correctly and doesn't like incomplete quotes
28-
# crowdin always outputs quoted strings if there are quotes in the strings.
29-
30-
# this script helps to unquote the crowdin outputs for the quirky ini library
20+
# the "ini" library for locale has many quirks, its behavior is different from Crowdin.
21+
# see i18n_test.go for more details
22+
23+
# this script helps to unquote the Crowdin outputs for the quirky ini library
3124
# * find all `key="...\"..."` lines
3225
# * remove the leading quote
3326
# * remove the trailing quote

‎go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ replace github.com/shurcooL/vfsgen => github.com/lunny/vfsgen v0.0.0-20220105142
289289

290290
replace github.com/blevesearch/zapx/v15 v15.3.6 => github.com/zeripath/zapx/v15 v15.3.6-alignment-fix
291291

292-
replace github.com/nektos/act => gitea.com/gitea/act v0.243.1
292+
replace github.com/nektos/act => gitea.com/gitea/act v0.243.2-0.20230329055922-5e76853b55ab
293293

294294
exclude github.com/gofrs/uuid v3.2.0+incompatible
295295

‎go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ codeberg.org/gusted/mcaptcha v0.0.0-20220723083913-4f3072e1d570/go.mod h1:IIAjsi
5252
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
5353
git.sr.ht/~mariusor/go-xsd-duration v0.0.0-20220703122237-02e73435a078 h1:cliQ4HHsCo6xi2oWZYKWW4bly/Ory9FuTpFPRxj/mAg=
5454
git.sr.ht/~mariusor/go-xsd-duration v0.0.0-20220703122237-02e73435a078/go.mod h1:g/V2Hjas6Z1UHUp4yIx6bATpNzJ7DYtD0FG3+xARWxs=
55-
gitea.com/gitea/act v0.243.1 h1:zIVlhGOLE4SHFPW++u3+5Y/jX5mub3QIhB13oNf6rtA=
56-
gitea.com/gitea/act v0.243.1/go.mod h1:iLHCXqOPUElA2nSyHo4wtxSmvdkym3WU7CkP3AxF39Q=
55+
gitea.com/gitea/act v0.243.2-0.20230329055922-5e76853b55ab h1:HDImhO/XpMJrw2PJcADI/wgur9Gro/pegLFaRt8Wpg0=
56+
gitea.com/gitea/act v0.243.2-0.20230329055922-5e76853b55ab/go.mod h1:mabw6AZAiDgxGlK83orWLrNERSPvgBJzEUS3S7u2bHI=
5757
gitea.com/go-chi/binding v0.0.0-20221013104517-b29891619681 h1:MMSPgnVULVwV9kEBgvyEUhC9v/uviZ55hPJEMjpbNR4=
5858
gitea.com/go-chi/binding v0.0.0-20221013104517-b29891619681/go.mod h1:77TZu701zMXWJFvB8gvTbQ92zQ3DQq/H7l5wAEjQRKc=
5959
gitea.com/go-chi/cache v0.0.0-20210110083709-82c4c9ce2d5e/go.mod h1:k2V/gPDEtXGjjMGuBJiapffAXTv76H4snSmlJRLUhH0=

‎models/actions/run.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,9 @@ func InsertRun(ctx context.Context, run *ActionRun, jobs []*jobparser.SingleWork
197197
for _, v := range jobs {
198198
id, job := v.Job()
199199
needs := job.Needs()
200-
job.EraseNeeds()
200+
if err := v.SetJob(id, job.EraseNeeds()); err != nil {
201+
return err
202+
}
201203
payload, _ := v.Marshal()
202204
status := StatusWaiting
203205
if len(needs) > 0 || run.NeedApproval {

‎models/auth/source.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,14 @@ func UpdateSource(source *Source) error {
317317
}
318318
}
319319

320-
_, err := db.GetEngine(db.DefaultContext).ID(source.ID).AllCols().Update(source)
320+
has, err := db.GetEngine(db.DefaultContext).Where("name=? AND id!=?", source.Name, source.ID).Exist(new(Source))
321+
if err != nil {
322+
return err
323+
} else if has {
324+
return ErrSourceAlreadyExist{source.Name}
325+
}
326+
327+
_, err = db.GetEngine(db.DefaultContext).ID(source.ID).AllCols().Update(source)
321328
if err != nil {
322329
return err
323330
}

‎modules/actions/workflows.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ func detectMatched(commit *git.Commit, triggedEvent webhook_module.HookEventType
122122
webhook_module.HookEventRepository,
123123
webhook_module.HookEventRelease,
124124
webhook_module.HookEventPackage:
125-
if len(evt.Acts) != 0 {
126-
log.Warn("Ignore unsupported %s event arguments %q", triggedEvent, evt.Acts)
125+
if len(evt.Acts()) != 0 {
126+
log.Warn("Ignore unsupported %s event arguments %v", triggedEvent, evt.Acts())
127127
}
128128
// no special filter parameters for these events, just return true if name matched
129129
return true
@@ -148,7 +148,7 @@ func detectMatched(commit *git.Commit, triggedEvent webhook_module.HookEventType
148148

149149
func matchPushEvent(commit *git.Commit, pushPayload *api.PushPayload, evt *jobparser.Event) bool {
150150
// with no special filter parameters
151-
if len(evt.Acts) == 0 {
151+
if len(evt.Acts()) == 0 {
152152
return true
153153
}
154154

@@ -157,7 +157,7 @@ func matchPushEvent(commit *git.Commit, pushPayload *api.PushPayload, evt *jobpa
157157
hasTagFilter := false
158158
refName := git.RefName(pushPayload.Ref)
159159
// all acts conditions should be satisfied
160-
for cond, vals := range evt.Acts {
160+
for cond, vals := range evt.Acts() {
161161
switch cond {
162162
case "branches":
163163
hasBranchFilter = true
@@ -241,18 +241,18 @@ func matchPushEvent(commit *git.Commit, pushPayload *api.PushPayload, evt *jobpa
241241
if hasBranchFilter && hasTagFilter {
242242
matchTimes++
243243
}
244-
return matchTimes == len(evt.Acts)
244+
return matchTimes == len(evt.Acts())
245245
}
246246

247247
func matchIssuesEvent(commit *git.Commit, issuePayload *api.IssuePayload, evt *jobparser.Event) bool {
248248
// with no special filter parameters
249-
if len(evt.Acts) == 0 {
249+
if len(evt.Acts()) == 0 {
250250
return true
251251
}
252252

253253
matchTimes := 0
254254
// all acts conditions should be satisfied
255-
for cond, vals := range evt.Acts {
255+
for cond, vals := range evt.Acts() {
256256
switch cond {
257257
case "types":
258258
for _, val := range vals {
@@ -265,19 +265,19 @@ func matchIssuesEvent(commit *git.Commit, issuePayload *api.IssuePayload, evt *j
265265
log.Warn("issue event unsupported condition %q", cond)
266266
}
267267
}
268-
return matchTimes == len(evt.Acts)
268+
return matchTimes == len(evt.Acts())
269269
}
270270

271271
func matchPullRequestEvent(commit *git.Commit, prPayload *api.PullRequestPayload, evt *jobparser.Event) bool {
272272
// with no special filter parameters
273-
if len(evt.Acts) == 0 {
273+
if len(evt.Acts()) == 0 {
274274
// defaultly, only pull request opened and synchronized will trigger workflow
275275
return prPayload.Action == api.HookIssueSynchronized || prPayload.Action == api.HookIssueOpened
276276
}
277277

278278
matchTimes := 0
279279
// all acts conditions should be satisfied
280-
for cond, vals := range evt.Acts {
280+
for cond, vals := range evt.Acts() {
281281
switch cond {
282282
case "types":
283283
action := prPayload.Action
@@ -339,18 +339,18 @@ func matchPullRequestEvent(commit *git.Commit, prPayload *api.PullRequestPayload
339339
log.Warn("pull request event unsupported condition %q", cond)
340340
}
341341
}
342-
return matchTimes == len(evt.Acts)
342+
return matchTimes == len(evt.Acts())
343343
}
344344

345345
func matchIssueCommentEvent(commit *git.Commit, issueCommentPayload *api.IssueCommentPayload, evt *jobparser.Event) bool {
346346
// with no special filter parameters
347-
if len(evt.Acts) == 0 {
347+
if len(evt.Acts()) == 0 {
348348
return true
349349
}
350350

351351
matchTimes := 0
352352
// all acts conditions should be satisfied
353-
for cond, vals := range evt.Acts {
353+
for cond, vals := range evt.Acts() {
354354
switch cond {
355355
case "types":
356356
for _, val := range vals {
@@ -363,5 +363,5 @@ func matchIssueCommentEvent(commit *git.Commit, issueCommentPayload *api.IssueCo
363363
log.Warn("issue comment unsupported condition %q", cond)
364364
}
365365
}
366-
return matchTimes == len(evt.Acts)
366+
return matchTimes == len(evt.Acts())
367367
}

‎modules/public/public.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ func AssetsHandlerFunc(opts *Options) http.HandlerFunc {
4545
return
4646
}
4747

48-
var corsSent bool
4948
if opts.CorsHandler != nil {
49+
var corsSent bool
5050
opts.CorsHandler(http.HandlerFunc(func(http.ResponseWriter, *http.Request) {
5151
corsSent = true
5252
})).ServeHTTP(resp, req)
53-
}
54-
// If CORS is not sent, the response must have been written by other handlers
55-
if !corsSent {
56-
return
53+
// If CORS is not sent, the response must have been written by other handlers
54+
if !corsSent {
55+
return
56+
}
5757
}
5858

5959
file := req.URL.Path[len(opts.Prefix):]

‎modules/translation/i18n/i18n_test.go

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package i18n
55

66
import (
7+
"strings"
78
"testing"
89

910
"github.com/stretchr/testify/assert"
@@ -75,3 +76,56 @@ c=22
7576
assert.Equal(t, "21", ls.Tr("lang1", "b"))
7677
assert.Equal(t, "22", ls.Tr("lang1", "c"))
7778
}
79+
80+
func TestLocaleStoreQuirks(t *testing.T) {
81+
const nl = "\n"
82+
q := func(q1, s string, q2 ...string) string {
83+
return q1 + s + strings.Join(q2, "")
84+
}
85+
testDataList := []struct {
86+
in string
87+
out string
88+
hint string
89+
}{
90+
{` xx`, `xx`, "simple, no quote"},
91+
{`" xx"`, ` xx`, "simple, double-quote"},
92+
{`' xx'`, ` xx`, "simple, single-quote"},
93+
{"` xx`", ` xx`, "simple, back-quote"},
94+
95+
{`x\"y`, `x\"y`, "no unescape, simple"},
96+
{q(`"`, `x\"y`, `"`), `"x\"y"`, "unescape, double-quote"},
97+
{q(`'`, `x\"y`, `'`), `x\"y`, "no unescape, single-quote"},
98+
{q("`", `x\"y`, "`"), `x\"y`, "no unescape, back-quote"},
99+
100+
{q(`"`, `x\"y`) + nl + "b=", `"x\"y`, "half open, double-quote"},
101+
{q(`'`, `x\"y`) + nl + "b=", `'x\"y`, "half open, single-quote"},
102+
{q("`", `x\"y`) + nl + "b=`", `x\"y` + nl + "b=", "half open, back-quote, multi-line"},
103+
104+
{`x ; y`, `x ; y`, "inline comment (;)"},
105+
{`x # y`, `x # y`, "inline comment (#)"},
106+
{`x \; y`, `x ; y`, `inline comment (\;)`},
107+
{`x \# y`, `x # y`, `inline comment (\#)`},
108+
}
109+
110+
for _, testData := range testDataList {
111+
ls := NewLocaleStore()
112+
err := ls.AddLocaleByIni("lang1", "Lang1", []byte("a="+testData.in), nil)
113+
assert.NoError(t, err, testData.hint)
114+
assert.Equal(t, testData.out, ls.Tr("lang1", "a"), testData.hint)
115+
assert.NoError(t, ls.Close())
116+
}
117+
118+
// TODO: Crowdin needs the strings to be quoted correctly and doesn't like incomplete quotes
119+
// and Crowdin always outputs quoted strings if there are quotes in the strings.
120+
// So, Gitea's `key="quoted" unquoted` content shouldn't be used on Crowdin directly,
121+
// it should be converted to `key="\"quoted\" unquoted"` first.
122+
// TODO: We can not use UnescapeValueDoubleQuotes=true, because there are a lot of back-quotes in en-US.ini,
123+
// then Crowdin will output:
124+
// > key = "`x \" y`"
125+
// Then Gitea will read a string with back-quotes, which is incorrect.
126+
// TODO: Crowdin might generate multi-line strings, quoted by double-quote, it's not supported by LocaleStore
127+
// LocaleStore uses back-quote for multi-line strings, it's not supported by Crowdin.
128+
// TODO: Crowdin doesn't support back-quote as string quoter, it mainly uses double-quote
129+
// so, the following line will be parsed as: value="`first", comment="second`" on Crowdin
130+
// > a = `first; second`
131+
}

‎options/locale/locale_en-US.ini

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2140,10 +2140,10 @@ settings.dismiss_stale_approvals_desc = When new commits that change the content
21402140
settings.require_signed_commits = Require Signed Commits
21412141
settings.require_signed_commits_desc = Reject pushes to this branch if they are unsigned or unverifiable.
21422142
settings.protect_branch_name_pattern = Protected Branch Name Pattern
2143-
settings.protect_protected_file_patterns = `Protected file patterns (separated using semicolon ';'):`
2144-
settings.protect_protected_file_patterns_desc = `Protected files are not allowed to be changed directly even if user has rights to add, edit, or delete files in this branch. Multiple patterns can be separated using semicolon (';'). See <a href="https://pkg.go.dev/github.com/gobwas/glob#Compile">github.com/gobwas/glob</a> documentation for pattern syntax. Examples: <code>.drone.yml</code>, <code>/docs/**/*.txt</code>.`
2145-
settings.protect_unprotected_file_patterns = `Unprotected file patterns (separated using semicolon ';'):`
2146-
settings.protect_unprotected_file_patterns_desc = `Unprotected files that are allowed to be changed directly if user has write access, bypassing push restriction. Multiple patterns can be separated using semicolon (';'). See <a href="https://pkg.go.dev/github.com/gobwas/glob#Compile">github.com/gobwas/glob</a> documentation for pattern syntax. Examples: <code>.drone.yml</code>, <code>/docs/**/*.txt</code>.`
2143+
settings.protect_protected_file_patterns = "Protected file patterns (separated using semicolon ';'):"
2144+
settings.protect_protected_file_patterns_desc = "Protected files are not allowed to be changed directly even if user has rights to add, edit, or delete files in this branch. Multiple patterns can be separated using semicolon (';'). See <a href='https://pkg.go.dev/github.com/gobwas/glob#Compile'>github.com/gobwas/glob</a> documentation for pattern syntax. Examples: <code>.drone.yml</code>, <code>/docs/**/*.txt</code>."
2145+
settings.protect_unprotected_file_patterns = "Unprotected file patterns (separated using semicolon ';'):"
2146+
settings.protect_unprotected_file_patterns_desc = "Unprotected files that are allowed to be changed directly if user has write access, bypassing push restriction. Multiple patterns can be separated using semicolon (';'). See <a href='https://pkg.go.dev/github.com/gobwas/glob#Compile'>github.com/gobwas/glob</a> documentation for pattern syntax. Examples: <code>.drone.yml</code>, <code>/docs/**/*.txt</code>."
21472147
settings.add_protected_branch = Enable protection
21482148
settings.delete_protected_branch = Disable protection
21492149
settings.update_protect_branch_success = Branch protection for rule '%s' has been updated.

‎options/locale/locale_ja-JP.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,6 +1068,7 @@ release=リリース
10681068
releases=リリース
10691069
tag=タグ
10701070
released_this=がこれをリリース
1071+
tagged_this=がタグ付け
10711072
file.title=%s at %s
10721073
file_raw=Raw
10731074
file_history=履歴
@@ -1276,6 +1277,7 @@ issues.choose.blank=デフォルト
12761277
issues.choose.blank_about=デフォルトのテンプレートからイシューを作成。
12771278
issues.choose.ignore_invalid_templates=無効なテンプレートが無視されました
12781279
issues.choose.invalid_templates=無効なテンプレートが%v 件見つかりました
1280+
issues.choose.invalid_config=イシューの設定にエラーがあります:
12791281
issues.no_ref=ブランチ/タグ指定なし
12801282
issues.create=イシューを作成
12811283
issues.new_label=新しいラベル
@@ -1489,6 +1491,9 @@ issues.due_date_invalid=期日が正しくないか範囲を超えています
14891491
issues.dependency.title=依存関係
14901492
issues.dependency.issue_no_dependencies=依存関係が設定されていません。
14911493
issues.dependency.pr_no_dependencies=依存関係が設定されていません。
1494+
issues.dependency.no_permission_1=%d 個の依存関係への読み取り権限がありません
1495+
issues.dependency.no_permission_n=%d 個の依存関係への読み取り権限がありません
1496+
issues.dependency.no_permission.can_remove=この依存関係への読み取り権限はありませんが、この依存関係は削除できます
14921497
issues.dependency.add=依存関係を追加...
14931498
issues.dependency.cancel=キャンセル
14941499
issues.dependency.remove=削除
@@ -2284,6 +2289,7 @@ release.compare=比較
22842289
release.edit=編集
22852290
release.ahead.commits=<strong>%d</strong>件のコミット
22862291
release.ahead.target=が、このリリース後 %s に追加されています
2292+
tag.ahead.target=が、このタグ付け後 %s に追加されています
22872293
release.source_code=ソースコード
22882294
release.new_subheader=リリースで、プロジェクトのバージョンを整理します。
22892295
release.edit_subheader=リリースで、プロジェクトのバージョンを整理します。

‎options/locale/locale_pt-PT.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2280,6 +2280,8 @@ diff.image.side_by_side=Lado a Lado
22802280
diff.image.swipe=Deslizar
22812281
diff.image.overlay=Sobrepor
22822282
diff.has_escaped=Esta linha tem caracteres unicode escondidos
2283+
diff.show_file_tree=Mostrar árvore de ficheiros
2284+
diff.hide_file_tree=Esconder árvore de ficheiros
22832285

22842286
releases.desc=Acompanhe as versões e as descargas do repositório.
22852287
release.releases=Lançamentos
@@ -3364,6 +3366,7 @@ runners.status.idle=Parada
33643366
runners.status.active=Em funcionamento
33653367
runners.status.offline=Desconectada
33663368
runners.version=Versão
3369+
runners.reset_registration_token_success=O código de incrição do executor foi reposto com sucesso
33673370

33683371
runs.all_workflows=Todas as sequências de trabalho
33693372
runs.open_tab=%d abertas

‎options/locale/locale_zh-CN.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2135,7 +2135,7 @@ settings.dismiss_stale_approvals_desc=当新的提交更改合并请求内容被
21352135
settings.require_signed_commits=需要签名提交
21362136
settings.require_signed_commits_desc=拒绝推送未签名或无法验证的提交到分支
21372137
settings.protect_branch_name_pattern=受保护的分支名称模式
2138-
settings.protect_protected_file_patterns=`受保护的文件模式(使用分号分隔 ' ;'):`
2138+
settings.protect_protected_file_patterns=`"受保护的文件模式 (使用分号 '\;' 分隔):" ;'):``
21392139
settings.protect_protected_file_patterns_desc=`即使用户有权添加、编辑或删除此分支中的文件,也不允许直接更改受保护的文件。 可以使用分号分隔多个模式(' ;'). See <a href="https://pkg.go.dev/github.com/gobwas/glob#Compile">github.com/gobwas/glob</a> documentation for pattern syntax. Examples: <code>.drone.yml</code>, <code>/docs/**/*.txt</code>.`
21402140
settings.protect_unprotected_file_patterns=`不受保护的文件模式 (使用分号分隔 ' ;'):`
21412141
settings.protect_unprotected_file_patterns_desc=`如果用户有写入权限,则允许直接更改的不受保护的文件,以绕过推送限制。可以使用分号分隔多重模式 (' ;'). See <a href="https://pkg.go.dev/github.com/gobwas/glob#Compile">github.com/gobwas/glob</a> documentation for pattern syntax. Examples: <code>.drone.yml</code>, <code>/docs/**/*.txt</code>.`

‎routers/web/admin/auths.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,9 +426,11 @@ func EditAuthSourcePost(ctx *context.Context) {
426426
source.IsActive = form.IsActive
427427
source.IsSyncEnabled = form.IsSyncEnabled
428428
source.Cfg = config
429-
// FIXME: if the name conflicts, it will result in 500: Error 1062: Duplicate entry 'aa' for key 'login_source.UQE_login_source_name'
430429
if err := auth.UpdateSource(source); err != nil {
431-
if oauth2.IsErrOpenIDConnectInitialize(err) {
430+
if auth.IsErrSourceAlreadyExist(err) {
431+
ctx.Data["Err_Name"] = true
432+
ctx.RenderWithErr(ctx.Tr("admin.auths.login_source_exist", err.(auth.ErrSourceAlreadyExist).Name), tplAuthEdit, form)
433+
} else if oauth2.IsErrOpenIDConnectInitialize(err) {
432434
ctx.Flash.Error(err.Error(), true)
433435
ctx.Data["Err_DiscoveryURL"] = true
434436
ctx.HTML(http.StatusOK, tplAuthEdit)

‎routers/web/admin/users.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ func NewUserPost(ctx *context.Context) {
105105
ctx.Data["PageIsAdmin"] = true
106106
ctx.Data["PageIsAdminUsers"] = true
107107
ctx.Data["DefaultUserVisibilityMode"] = setting.Service.DefaultUserVisibilityMode
108+
ctx.Data["AllowedUserVisibilityModes"] = setting.Service.AllowedUserVisibilityModesSlice.ToVisibleTypeSlice()
108109

109110
sources, err := auth.Sources()
110111
if err != nil {
@@ -273,6 +274,7 @@ func EditUserPost(ctx *context.Context) {
273274
ctx.Data["PageIsAdmin"] = true
274275
ctx.Data["PageIsAdminUsers"] = true
275276
ctx.Data["DisableMigrations"] = setting.Repository.DisableMigrations
277+
ctx.Data["AllowedUserVisibilityModes"] = setting.Service.AllowedUserVisibilityModesSlice.ToVisibleTypeSlice()
276278

277279
u := prepareUserInfo(ctx)
278280
if ctx.Written() {
@@ -314,13 +316,13 @@ func EditUserPost(ctx *context.Context) {
314316
log.Error(err.Error())
315317
errMsg = ctx.Tr("auth.password_pwned_err")
316318
}
317-
ctx.RenderWithErr(errMsg, tplUserNew, &form)
319+
ctx.RenderWithErr(errMsg, tplUserEdit, &form)
318320
return
319321
}
320322

321323
if err := user_model.ValidateEmail(form.Email); err != nil {
322324
ctx.Data["Err_Email"] = true
323-
ctx.RenderWithErr(ctx.Tr("form.email_error"), tplUserNew, &form)
325+
ctx.RenderWithErr(ctx.Tr("form.email_error"), tplUserEdit, &form)
324326
return
325327
}
326328

@@ -336,7 +338,10 @@ func EditUserPost(ctx *context.Context) {
336338

337339
if len(form.UserName) != 0 && u.Name != form.UserName {
338340
if err := user_setting.HandleUsernameChange(ctx, u, form.UserName); err != nil {
339-
ctx.Redirect(setting.AppSubURL + "/admin/users")
341+
if ctx.Written() {
342+
return
343+
}
344+
ctx.RenderWithErr(ctx.Flash.ErrorMsg, tplUserEdit, &form)
340345
return
341346
}
342347
u.Name = form.UserName

‎templates/home.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{{template "base/head" .}}
22
<div role="main" aria-label="{{if .IsSigned}}{{.locale.Tr "dashboard"}}{{else}}{{.locale.Tr "home"}}{{end}}" class="page-content home">
3-
<div class="ui stackable middle very relaxed page grid">
3+
<div class="ui middle very relaxed page gt-mb-5">
44
<div class="sixteen wide center aligned centered column">
55
<div>
66
<img class="logo" width="220" height="220" src="{{AssetUrlPrefix}}/img/logo.svg" alt="{{.locale.Tr "logo"}}">

‎templates/repo/commit_status.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{if eq .State "pending"}}
2-
{{svg "octicon-dot-fill" 18 "commit-status icon text yellow"}}
2+
{{svg "octicon-dot-fill" 18 "commit-status icon text grey"}}
33
{{end}}
44
{{if eq .State "running"}}
55
{{svg "octicon-dot-fill" 18 "commit-status icon text yellow"}}

‎templates/repo/issue/list.tmpl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@
2929
<div id="issue-filters" class="ui stackable grid">
3030
<div class="six wide column">
3131
{{if $.CanWriteIssuesOrPulls}}
32-
<div class="ui checkbox issue-checkbox-all gt-vm">
33-
<input type="checkbox" title="{{.locale.Tr "repo.issues.action_check_all"}}">
34-
</div>
32+
<input type="checkbox" autocomplete="off" class="issue-checkbox-all gt-vm gt-mr-4" title="{{.locale.Tr "repo.issues.action_check_all"}}">
3533
{{end}}
3634
{{template "repo/issue/openclose" .}}
3735
</div>
@@ -179,12 +177,12 @@
179177
{{end}}
180178

181179
<!-- Sort -->
182-
<div class="ui dropdown type jump item">
180+
<div class="ui dropdown downward type jump item">
183181
<span class="text">
184182
{{.locale.Tr "repo.issues.filter_sort"}}
185183
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
186184
</span>
187-
<div class="menu">
185+
<div class="left menu">
188186
<a class="{{if or (eq .SortType "latest") (not .SortType)}}active {{end}}item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort=latest&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}">{{.locale.Tr "repo.issues.filter_sort.latest"}}</a>
189187
<a class="{{if eq .SortType "oldest"}}active {{end}}item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort=oldest&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}">{{.locale.Tr "repo.issues.filter_sort.oldest"}}</a>
190188
<a class="{{if eq .SortType "recentupdate"}}active {{end}}item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort=recentupdate&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}">{{.locale.Tr "repo.issues.filter_sort.recentupdate"}}</a>

‎templates/repo/issue/view_content/pull.tmpl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@
128128
{{- else}}red{{end}}">{{svg "octicon-git-merge" 32}}</a>
129129
<div class="content">
130130
{{template "repo/pulls/status" .}}
131-
{{$canAutoMerge := false}}
132131
{{$showGeneralMergeForm := false}}
133132
<div class="ui attached merge-section segment {{if not $.LatestCommitStatus}}no-header{{end}}">
134133
{{if .Issue.PullRequest.HasMerged}}
@@ -193,7 +192,7 @@
193192
{{end}}
194193
</div>
195194
</div>
196-
{{template "repo/issue/view_content/update_branch_by_merge" (dict "locale" .locale "Issue" .Issue "UpdateAllowed" .UpdateAllowed "UpdateByRebaseAllowed" .UpdateByRebaseAllowed "Link" .Link)}}
195+
{{template "repo/issue/view_content/update_branch_by_merge" $}}
197196
{{else if .Issue.PullRequest.IsChecking}}
198197
<div class="item">
199198
<i class="icon icon-octicon">{{svg "octicon-sync"}}</i>
@@ -286,7 +285,7 @@
286285
</div>
287286
{{end}}
288287
{{end}}
289-
{{template "repo/issue/view_content/update_branch_by_merge" (dict "locale" .locale "Issue" .Issue "UpdateAllowed" .UpdateAllowed "UpdateByRebaseAllowed" .UpdateByRebaseAllowed "Link" .Link)}}
288+
{{template "repo/issue/view_content/update_branch_by_merge" $}}
290289
{{if .Issue.PullRequest.IsEmpty}}
291290
<div class="ui divider"></div>
292291

‎templates/repo/issue/view_content/update_branch_by_merge.tmpl

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
{{$canAutoMerge := false}}
2-
{{if and (gt .Issue.PullRequest.CommitsBehind 0) (not .Issue.IsClosed) (not .Issue.PullRequest.IsChecking) (not .IsPullFilesConflicted) (not .IsPullRequestBroken) (not $canAutoMerge)}}
1+
{{if and (gt $.Issue.PullRequest.CommitsBehind 0) (not $.Issue.IsClosed) (not $.Issue.PullRequest.IsChecking) (not $.IsPullFilesConflicted) (not $.IsPullRequestBroken)}}
32
<div class="ui divider"></div>
43
<div class="item item-section">
54
<div class="item-section-left">
65
<i class="icon icon-octicon">{{svg "octicon-alert"}}</i>
76
{{$.locale.Tr "repo.pulls.outdated_with_base_branch"}}
87
</div>
98
<div class="item-section-right">
10-
{{if and .UpdateAllowed .UpdateByRebaseAllowed}}
9+
{{if and $.UpdateAllowed $.UpdateByRebaseAllowed}}
1110
<div class="gt-dib">
1211
<div class="ui buttons update-button">
13-
<button class="ui button" data-do="{{.Link}}/update" data-redirect="{{.Link}}">
12+
<button class="ui button" data-do="{{$.Link}}/update" data-redirect="{{$.Link}}">
1413
<span class="button-text">
1514
{{$.locale.Tr "repo.pulls.update_branch"}}
1615
</span>
@@ -19,17 +18,17 @@
1918
<div class="ui dropdown icon button no-text">
2019
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
2120
<div class="menu">
22-
<a class="item active selected" data-do="{{.Link}}/update">{{$.locale.Tr "repo.pulls.update_branch"}}</a>
23-
<a class="item" data-do="{{.Link}}/update?style=rebase">{{$.locale.Tr "repo.pulls.update_branch_rebase"}}</a>
21+
<a class="item active selected" data-do="{{$.Link}}/update">{{$.locale.Tr "repo.pulls.update_branch"}}</a>
22+
<a class="item" data-do="{{$.Link}}/update?style=rebase">{{$.locale.Tr "repo.pulls.update_branch_rebase"}}</a>
2423
</div>
2524
</div>
2625
</div>
2726
</div>
2827
{{end}}
29-
{{if and .UpdateAllowed (not .UpdateByRebaseAllowed)}}
30-
<form action="{{.Link}}/update" method="post" class="ui update-branch-form">
31-
{{.CsrfTokenHtml}}
32-
<button class="ui compact button" data-do="update">
28+
{{if and $.UpdateAllowed (not $.UpdateByRebaseAllowed)}}
29+
<form action="{{$.Link}}/update" method="post" class="ui update-branch-form">
30+
{{$.CsrfTokenHtml}}
31+
<button class="ui compact button">
3332
<span class="ui text">{{$.locale.Tr "repo.pulls.update_branch"}}</span>
3433
</button>
3534
</form>

‎templates/shared/issuelist.tmpl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22
{{$approvalCounts := .ApprovalCounts}}
33
{{range .Issues}}
44
<li class="item gt-df gt-py-3">
5-
<div class="issue-item-left gt-df">
5+
<div class="issue-item-left gt-df gt-items-start">
66
{{if $.CanWriteIssuesOrPulls}}
7-
<div class="ui checkbox issue-checkbox">
8-
<input type="checkbox" data-issue-id={{.ID}} title="{{$.locale.Tr "repo.issues.action_check"}} «{{.Title}}»">
9-
</div>
7+
<input type="checkbox" autocomplete="off" class="issue-checkbox gt-mt-2 gt-mr-4" data-issue-id={{.ID}} aria-label="{{$.locale.Tr "repo.issues.action_check"}} &quot;{{.Title}}&quot;">
108
{{end}}
119
<div class="issue-item-icon">
1210
{{if .IsPull}}

‎tests/integration/repo_commits_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func testRepoCommitsWithStatus(t *testing.T, resp, respOne *httptest.ResponseRec
110110
}
111111

112112
func TestRepoCommitsWithStatusPending(t *testing.T) {
113-
doTestRepoCommitWithStatus(t, "pending", "octicon-dot-fill", "yellow")
113+
doTestRepoCommitWithStatus(t, "pending", "octicon-dot-fill", "grey")
114114
}
115115

116116
func TestRepoCommitsWithStatusSuccess(t *testing.T) {
@@ -129,6 +129,10 @@ func TestRepoCommitsWithStatusWarning(t *testing.T) {
129129
doTestRepoCommitWithStatus(t, "warning", "gitea-exclamation", "yellow")
130130
}
131131

132+
func TestRepoCommitsWithStatusRunning(t *testing.T) {
133+
doTestRepoCommitWithStatus(t, "running", "octicon-dot-fill", "yellow")
134+
}
135+
132136
func TestRepoCommitsStatusParallel(t *testing.T) {
133137
defer tests.PrepareTestEnv(t)()
134138

‎web_src/css/base.css

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@
7878
--color-purple: #a333c8;
7979
--color-pink: #e03997;
8080
--color-brown: #a5673f;
81-
--color-grey: #888888;
8281
--color-black: #1b1c1d;
8382
/* light variants - produced via Sass scale-color(color, $lightness: +25%) */
8483
--color-red-light: #e45e5e;
@@ -92,9 +91,10 @@
9291
--color-purple-light: #bb64d8;
9392
--color-pink-light: #e86bb1;
9493
--color-brown-light: #c58b66;
95-
--color-grey-light: #a6a6a6;
9694
--color-black-light: #525558;
9795
/* other colors */
96+
--color-grey: #707070;
97+
--color-grey-light: #838383;
9898
--color-gold: #a1882b;
9999
--color-white: #ffffff;
100100
--color-diff-removed-word-bg: #fdb8c0;
@@ -2657,6 +2657,10 @@ table th[data-sortt-desc] .svg {
26572657
border-radius: 0 0 var(--border-radius) var(--border-radius);
26582658
}
26592659

2660+
.ui.multiple.dropdown > .label {
2661+
box-shadow: 0 0 0 1px var(--color-secondary) inset;
2662+
}
2663+
26602664
.text-label {
26612665
display: inline-flex !important;
26622666
align-items: center !important;

‎web_src/css/form.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,15 @@ textarea:focus,
9494
color: var(--color-text);
9595
}
9696

97+
.ui.form .required.fields:not(.grouped) > .field > label::after,
98+
.ui.form .required.fields.grouped > label::after,
99+
.ui.form .required.field > label::after,
100+
.ui.form .required.fields:not(.grouped) > .field > .checkbox::after,
101+
.ui.form .required.field > .checkbox::after,
102+
.ui.form label.required::after {
103+
color: var(--color-red);
104+
}
105+
97106
.ui.input,
98107
.ui.checkbox input:focus ~ label::after,
99108
.ui.checkbox input:checked ~ label::after,

‎web_src/css/helpers.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
.gt-relative { position: relative !important; }
2525
.gt-overflow-x-scroll { overflow-x: scroll !important; }
2626
.gt-cursor-default { cursor: default !important; }
27+
.gt-items-start { align-items: flex-start !important; }
2728

2829
.gt-mono {
2930
font-family: var(--fonts-monospace) !important;

‎web_src/css/shared/issuelist.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
color: var(--color-primary) !important;
88
}
99

10-
.issue.list > .item .issue-checkbox {
11-
margin-top: 1px;
12-
}
13-
1410
.issue.list > .item .issue-item-icon svg {
1511
margin-right: 0.75rem;
1612
margin-top: 1px;

‎web_src/css/themes/theme-arc-green.css

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@
6868
--color-purple: #b259d0;
6969
--color-pink: #d22e8b;
7070
--color-brown: #a47252;
71-
--color-grey: #9ea2aa;
72-
--color-black: #1e222e;
71+
--color-black: #2e323e;
7372
/* light variants - produced via Sass scale-color(color, $lightness: -10%) */
7473
--color-red-light: #c23636;
7574
--color-orange-light: #b84f0b;
@@ -82,9 +81,10 @@
8281
--color-purple-light: #a742c9;
8382
--color-pink-light: #be297d;
8483
--color-brown-light: #94674a;
85-
--color-grey-light: #8d919b;
86-
--color-black-light: #1b1f29;
84+
--color-black-light: #292d38;
8785
/* other colors */
86+
--color-grey: #505665;
87+
--color-grey-light: #a1a6b7;
8888
--color-gold: #b1983b;
8989
--color-white: #ffffff;
9090
--color-diff-removed-word-bg: #6f3333;
@@ -124,19 +124,19 @@
124124
--color-orange-badge-hover-bg: #f2711c4d;
125125
--color-git: #f05133;
126126
/* target-based colors */
127-
--color-body: #383c4a;
127+
--color-body: #373b47;
128128
--color-box-header: #404652;
129129
--color-box-body: #2a2e3a;
130130
--color-box-body-highlight: #353945;
131131
--color-text-dark: #dbe0ea;
132-
--color-text: #bbc0ca;
133-
--color-text-light: #a6aab5;
134-
--color-text-light-1: #979ba6;
135-
--color-text-light-2: #8a8e99;
136-
--color-text-light-3: #707687;
132+
--color-text: #cbd0da;
133+
--color-text-light: #bbbfca;
134+
--color-text-light-1: #aaafb9;
135+
--color-text-light-2: #9a9ea9;
136+
--color-text-light-3: #8a8e99;
137137
--color-footer: #2e323e;
138138
--color-timeline: #4c525e;
139-
--color-input-text: #d5dbe6;
139+
--color-input-text: #dfe3ec;
140140
--color-input-background: #232933;
141141
--color-input-toggle-background: #454a57;
142142
--color-input-border: #454a57;
@@ -159,7 +159,7 @@
159159
--color-secondary-bg: #2a2e3a;
160160
--color-text-focus: #fff;
161161
--color-expand-button: #3c404d;
162-
--color-placeholder-text: #6a737d;
162+
--color-placeholder-text: #8a8e99;
163163
--color-editor-line-highlight: var(--color-primary-light-5);
164164
--color-project-board-bg: var(--color-secondary-light-2);
165165
--color-caret: var(--color-text); /* should ideally be --color-text-dark, see #15651 */

‎web_src/js/components/RepoActionView.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div class="action-view-container">
33
<div class="action-view-header">
4-
<div class="action-info-summary">
4+
<div class="action-info-summary gt-ac">
55
<ActionRunStatus :status="run.status" :size="20"/>
66
<div class="action-title">
77
{{ run.title }}
@@ -30,7 +30,7 @@
3030
<div class="job-brief-item" v-for="(job, index) in run.jobs" :key="job.id">
3131
<a class="job-brief-link" :href="run.link+'/jobs/'+index">
3232
<ActionRunStatus :status="job.status"/>
33-
<span class="ui text">{{ job.name }}</span>
33+
<span class="ui text gt-mx-3">{{ job.name }}</span>
3434
</a>
3535
<button class="job-brief-rerun" @click="rerunJob(index)" v-if="job.canRerun">
3636
<SvgIcon name="octicon-sync" class="ui text black"/>
@@ -446,7 +446,6 @@ export function ansiLogToHTML(line) {
446446
}
447447
448448
.job-group-section .job-brief-list .job-brief-item .job-brief-link span {
449-
margin-right: 8px;
450449
display: flex;
451450
align-items: center;
452451
}

‎web_src/js/features/common-global.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,15 @@ export function initGlobalCommon() {
111111
},
112112
});
113113

114-
// special popup-directions
114+
// Special popup-directions, prevent Fomantic from guessing the popup direction.
115+
// With default "direction: auto", if the viewport height is small, Fomantic would show the popup upward,
116+
// if the dropdown is at the beginning of the page, then the top part would be clipped by the window view.
117+
// eg: Issue List "Sort" dropdown
118+
// But we can not set "direction: downward" for all dropdowns, because there is a bug in dropdown menu positioning when calculating the "left" position,
119+
// which would make some dropdown popups slightly shift out of the right viewport edge in some cases.
120+
// eg: the "Create New Repo" menu on the navbar.
115121
$uiDropdowns.filter('.upward').dropdown('setting', 'direction', 'upward');
122+
$uiDropdowns.filter('.downward').dropdown('setting', 'direction', 'downward');
116123

117124
$('.ui.checkbox').checkbox();
118125

‎web_src/js/features/common-issue.js

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ import {updateIssuesMeta} from './repo-issue.js';
33
import {toggleElem} from '../utils/dom.js';
44

55
export function initCommonIssue() {
6-
const $issueSelectAllWrapper = $('.issue-checkbox-all');
7-
const $issueSelectAll = $('.issue-checkbox-all input');
8-
const $issueCheckboxes = $('.issue-checkbox input');
6+
const $issueSelectAll = $('.issue-checkbox-all');
7+
const $issueCheckboxes = $('.issue-checkbox');
98

109
const syncIssueSelectionState = () => {
1110
const $checked = $issueCheckboxes.filter(':checked');
@@ -23,7 +22,7 @@ export function initCommonIssue() {
2322
toggleElem($('#issue-filters'), !anyChecked);
2423
toggleElem($('#issue-actions'), anyChecked);
2524
// there are two panels but only one select-all checkbox, so move the checkbox to the visible panel
26-
$('#issue-filters, #issue-actions').filter(':visible').find('.column:first').prepend($issueSelectAllWrapper);
25+
$('#issue-filters, #issue-actions').filter(':visible').find('.column:first').prepend($issueSelectAll);
2726
};
2827

2928
$issueCheckboxes.on('change', syncIssueSelectionState);
@@ -38,7 +37,7 @@ export function initCommonIssue() {
3837
let action = this.getAttribute('data-action');
3938
let elementId = this.getAttribute('data-element-id');
4039
const url = this.getAttribute('data-url');
41-
const issueIDs = $('.issue-checkbox').children('input:checked').map((_, el) => {
40+
const issueIDs = $('.issue-checkbox:checked').map((_, el) => {
4241
return el.getAttribute('data-issue-id');
4342
}).get().join(',');
4443
if (elementId === '0' && url.slice(-9) === '/assignee') {
@@ -54,20 +53,7 @@ export function initCommonIssue() {
5453
issueIDs,
5554
elementId
5655
).then(() => {
57-
// NOTICE: This reset of checkbox state targets Firefox caching behaviour, as the
58-
// checkboxes stay checked after reload
59-
if (action === 'close' || action === 'open') {
60-
// uncheck all checkboxes
61-
$('.issue-checkbox input[type="checkbox"]').each((_, e) => { e.checked = false });
62-
}
6356
window.location.reload();
6457
});
6558
});
66-
67-
// NOTICE: This event trigger targets Firefox caching behaviour, as the checkboxes stay
68-
// checked after reload trigger checked event, if checkboxes are checked on load
69-
$('.issue-checkbox input[type="checkbox"]:checked').first().each((_, e) => {
70-
e.checked = false;
71-
$(e).trigger('click');
72-
});
7359
}

‎web_src/js/modules/fomantic.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ export function initGiteaFomantic() {
99
// Disable the behavior of fomantic to toggle the checkbox when you press enter on a checkbox element.
1010
$.fn.checkbox.settings.enableEnterKey = false;
1111

12-
// Prevent Fomantic from guessing the popup direction.
13-
// Otherwise, if the viewport height is small, Fomantic would show the popup upward,
14-
// if the dropdown is at the beginning of the page, then the top part would be clipped by the window view, eg: Issue List "Sort" dropdown
15-
$.fn.dropdown.settings.direction = 'downward';
1612
// By default, use "exact match" for full text search
1713
$.fn.dropdown.settings.fullTextSearch = 'exact';
1814
// Do not use "cursor: pointer" for dropdown labels

0 commit comments

Comments
 (0)
Please sign in to comment.