Skip to content

Commit f9c788c

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

30 files changed

+182
-114
lines changed

build/update-locales.sh

+4-11
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

+1-1
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

+2-2
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

+3-1
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

+8-1
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

+14-14
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

+5-5
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

+54
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

+4-4
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

+6
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

+3
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

+1-1
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

+4-2
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

+8-3
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

+1-1
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"}}">

0 commit comments

Comments
 (0)