Skip to content

Commit 17fbbe9

Browse files
authored
Do not disable commit changes button on repost (#12644)
If the user has pressed commit changes and the post has failed - do not disable the commit changes button. Fix #12072 Signed-off-by: Andrew Thornton <art27@cantab.net>
1 parent 9abc16a commit 17fbbe9

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

routers/repo/editor.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bo
184184
}
185185

186186
ctx.Data["PageIsEdit"] = true
187+
ctx.Data["PageHasPosted"] = true
187188
ctx.Data["IsNewFile"] = isNewFile
188189
ctx.Data["RequireHighlightJS"] = true
189190
ctx.Data["RequireSimpleMDE"] = true

templates/repo/editor/edit.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<form class="ui edit form" method="post">
77
{{.CsrfTokenHtml}}
88
<input type="hidden" name="last_commit" value="{{.last_commit}}">
9+
<input type="hidden" name="page_has_posted" value="{{.PageHasPosted}}">
910
<div class="ui secondary menu">
1011
<div class="fitted item treepath">
1112
<div class="ui breadcrumb field {{if .Err_TreePath}}error{{end}}">

web_src/js/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1592,7 +1592,9 @@ async function initEditor() {
15921592
const dirtyFileClass = 'dirty-file';
15931593

15941594
// Disabling the button at the start
1595-
$commitButton.prop('disabled', true);
1595+
if ($('input[name="page_has_posted"]').val() !== 'true') {
1596+
$commitButton.prop('disabled', true);
1597+
}
15961598

15971599
// Registering a custom listener for the file path and the file content
15981600
$editForm.areYouSure({

0 commit comments

Comments
 (0)