Skip to content

Commit f530856

Browse files
committed
Move lfs cannot edit context data
1 parent c6598c2 commit f530856

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

routers/web/repo/view_file.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,6 @@ func prepareToRenderFile(ctx *context.Context, entry *git.TreeEntry) {
140140
ctx.Data["LFSLockHint"] = ctx.Tr("repo.editor.this_file_locked")
141141
}
142142

143-
// Assume file is not editable first.
144-
if fInfo.isLFSFile {
145-
ctx.Data["EditFileTooltip"] = ctx.Tr("repo.editor.cannot_edit_lfs_files")
146-
}
147-
148143
// read all needed attributes which will be used later
149144
// there should be no performance different between reading 2 or 4 here
150145
attrsMap, err := attribute.CheckAttributes(ctx, ctx.Repo.GitRepo, ctx.Repo.CommitID, attribute.CheckAttributeOpts{
@@ -290,7 +285,9 @@ func prepareToRenderFile(ctx *context.Context, entry *git.TreeEntry) {
290285
}
291286
}
292287

293-
if !fInfo.isLFSFile {
288+
if fInfo.isLFSFile {
289+
ctx.Data["EditFileTooltip"] = ctx.Tr("repo.editor.cannot_edit_lfs_files")
290+
} else {
294291
if ctx.Repo.CanEnableEditor(ctx, ctx.Doer) {
295292
if lfsLock != nil && lfsLock.OwnerID != ctx.Doer.ID {
296293
ctx.Data["CanEditFile"] = false

0 commit comments

Comments
 (0)