From 157484d50c5e84d780b129b5bc56bd262e4fc090 Mon Sep 17 00:00:00 2001 From: davrot Date: Mon, 27 Jan 2025 20:48:42 +0000 Subject: [PATCH] =?UTF-8?q?Dateien=20nach=20=E2=80=9Erouters/web/repo?= =?UTF-8?q?=E2=80=9C=20hochladen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routers/web/repo/editor.go | 6 +++--- routers/web/repo/view.go | 29 ++++++++++++++--------------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/routers/web/repo/editor.go b/routers/web/repo/editor.go index 7cd201810e..f2225fb77c 100644 --- a/routers/web/repo/editor.go +++ b/routers/web/repo/editor.go @@ -491,17 +491,17 @@ func DeleteFile(ctx *context.Context) { // DeletePath render delete file page func DeletePath(ctx *context.Context) { - DeleteFile(ctx) + DeleteFile(ctx) } // DeleteFilePost response for deleting file func DeleteFilePost(ctx *context.Context) { - DeletePathOrFilePost(ctx, false) + DeletePathOrFilePost(ctx, false) } // DeletePathPost response for deleting path func DeletePathPost(ctx *context.Context) { - DeletePathOrFilePost(ctx, true) + DeletePathOrFilePost(ctx, true) } // DeletePathOrFilePost response for deleting path or file diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go index 619f0f7968..50f9e8b9e8 100644 --- a/routers/web/repo/view.go +++ b/routers/web/repo/view.go @@ -967,7 +967,6 @@ func prepareOpenWithEditorApps(ctx *context.Context) { } func renderHomeCode(ctx *context.Context) { - ctx.Data["PageIsViewCode"] = true ctx.Data["RepositoryUploadEnabled"] = setting.Repository.Upload.Enabled prepareOpenWithEditorApps(ctx) @@ -1165,20 +1164,20 @@ PostRecentBranchCheck: ctx.Data["CodeSearchOptions"] = git.GrepSearchOptions } - lfsLock, err := git_model.GetTreePathLock(ctx, ctx.Repo.Repository.ID, ctx.Repo.TreePath) - if ctx.Repo.CanEnableEditor(ctx, ctx.Doer) { - if lfsLock != nil && lfsLock.OwnerID != ctx.Doer.ID { - ctx.Data["CanDeleteFile"] = false - ctx.Data["DeleteFileTooltip"] = ctx.Tr("repo.editor.this_file_locked") - } else { - ctx.Data["CanDeleteFile"] = true - ctx.Data["DeleteFileTooltip"] = ctx.Tr("repo.editor.delete_this_file") - } - } else if !ctx.Repo.IsViewBranch { - ctx.Data["DeleteFileTooltip"] = ctx.Tr("repo.editor.must_be_on_a_branch") - } else if !ctx.Repo.CanWriteToBranch(ctx, ctx.Doer, ctx.Repo.BranchName) { - ctx.Data["DeleteFileTooltip"] = ctx.Tr("repo.editor.must_have_write_access") - } + lfsLock, err := git_model.GetTreePathLock(ctx, ctx.Repo.Repository.ID, ctx.Repo.TreePath) + if ctx.Repo.CanEnableEditor(ctx, ctx.Doer) { + if lfsLock != nil && lfsLock.OwnerID != ctx.Doer.ID { + ctx.Data["CanDeleteFile"] = false + ctx.Data["DeleteFileTooltip"] = ctx.Tr("repo.editor.this_file_locked") + } else { + ctx.Data["CanDeleteFile"] = true + ctx.Data["DeleteFileTooltip"] = ctx.Tr("repo.editor.delete_this_file") + } + } else if !ctx.Repo.IsViewBranch { + ctx.Data["DeleteFileTooltip"] = ctx.Tr("repo.editor.must_be_on_a_branch") + } else if !ctx.Repo.CanWriteToBranch(ctx, ctx.Doer, ctx.Repo.BranchName) { + ctx.Data["DeleteFileTooltip"] = ctx.Tr("repo.editor.must_have_write_access") + } ctx.HTML(http.StatusOK, tplRepoHome) }