Skip to content

Commit 974eae8

Browse files
committed
upate go-gitea#8687 Add LFS locker information
1 parent a5758b9 commit 974eae8

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

routers/repo/view.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,16 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st
267267
}
268268
}
269269
lfsLock, err := ctx.Repo.Repository.GetTreePathLock(ctx.Repo.TreePath)
270+
ctx.Data["LFSLock"] = lfsLock
270271
if err != nil {
271272
ctx.ServerError("GetTreePathLock", err)
272273
}
273-
if lfsLock != nil && lfsLock.OwnerID != ctx.User.ID {
274-
isLFSLock = true
274+
if lfsLock != nil {
275+
ctx.Data["LFSLockOwner"] = lfsLock.Owner.DisplayName()
276+
ctx.Data["LFSLockHint"] = ctx.Tr("repo.editor.this_file_locked")
277+
if lfsLock.OwnerID != ctx.User.ID {
278+
isLFSLock = true
279+
}
275280
}
276281

277282
// Assume file is not editable first.

templates/repo/view_file.tmpl

+6
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
{{FileSize .FileSize}}{{if .IsLFSFile}} ({{.i18n.Tr "repo.stored_lfs"}}){{end}}
1717
</div>
1818
{{end}}
19+
{{if .LFSLock}}
20+
<div class="file-info-entry">
21+
<i class="fa fa-lock poping up disabled" data-content="{{.LFSLockHint}}" data-position="bottom center" data-variation="tiny inverted"></i>
22+
{{.LFSLockOwner}}
23+
</div>
24+
{{end}}
1925
</div>
2026
{{end}}
2127
</div>

0 commit comments

Comments
 (0)