mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-04-21 15:26:42 +02:00
Dateien nach „routers/web/repo“ hochladen
This commit is contained in:
parent
fa5158c1f9
commit
157484d50c
2 changed files with 17 additions and 18 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue