aboutsummaryrefslogtreecommitdiffstats
path: root/routers/repo/blame.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/repo/blame.go')
-rw-r--r--routers/repo/blame.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/routers/repo/blame.go b/routers/repo/blame.go
index 5578942a9f..f5a2a548e3 100644
--- a/routers/repo/blame.go
+++ b/routers/repo/blame.go
@@ -119,8 +119,19 @@ func RefBlame(ctx *context.Context) {
ctx.Data["IsBlame"] = true
if ctx.Repo.CanEnableEditor() {
- ctx.Data["CanDeleteFile"] = true
- ctx.Data["DeleteFileTooltip"] = ctx.Tr("repo.editor.delete_this_file")
+ // Check LFS Lock
+ lfsLock, err := ctx.Repo.Repository.GetTreePathLock(ctx.Repo.TreePath)
+ if err != nil {
+ ctx.ServerError("GetTreePathLock", err)
+ return
+ }
+ if lfsLock != nil && lfsLock.OwnerID != ctx.User.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.CanWrite(models.UnitTypeCode) {