mirror of
https://github.com/go-gitea/gitea.git
synced 2025-06-05 00:01:37 -04:00
Use NotEditableReason to check if file is editable
This commit is contained in:
parent
42b7c87288
commit
32e2f4f470
@ -173,8 +173,6 @@ func editFile(ctx *context.Context, isNewFile bool) {
|
||||
ctx.Data["FileSize"] = fInfo.fileSize
|
||||
|
||||
// Only some file types are editable online as text.
|
||||
ctx.Data["IsFileEditable"] = fInfo.st.IsRepresentableAsText() && !fInfo.isLFSFile && fInfo.fileSize < setting.UI.MaxDisplayFileSize
|
||||
|
||||
if fInfo.isLFSFile {
|
||||
ctx.Data["NotEditableReason"] = ctx.Tr("repo.editor.cannot_edit_lfs_files")
|
||||
} else if !fInfo.st.IsRepresentableAsText() {
|
||||
@ -195,8 +193,6 @@ func editFile(ctx *context.Context, isNewFile bool) {
|
||||
} else {
|
||||
// Append filename from query, or empty string to allow username the new file.
|
||||
treeNames = append(treeNames, fileName)
|
||||
|
||||
ctx.Data["IsFileEditable"] = true
|
||||
}
|
||||
|
||||
ctx.Data["TreeNames"] = treeNames
|
||||
|
@ -28,7 +28,7 @@
|
||||
<input type="hidden" id="tree_path" name="tree_path" value="{{.TreePath}}" required>
|
||||
</div>
|
||||
</div>
|
||||
{{if .IsFileEditable}}
|
||||
{{if not .NotEditableReason}}
|
||||
<div class="field">
|
||||
<div class="ui top attached header">
|
||||
<div class="ui compact small menu small-menu-items repo-editor-menu">
|
||||
|
Loading…
x
Reference in New Issue
Block a user