From 3f5c3c1e89ffbb0fc520fc2faddba9484d3fca22 Mon Sep 17 00:00:00 2001
From: Andreas Gohr <andi@splitbrain.org>
Date: Fri, 27 Apr 2018 08:41:12 +0200
Subject: [PATCH] unlock in cancel action

and actually use it in the edit form.
---
 inc/Action/Cancel.php | 4 ++++
 inc/html.php          | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/inc/Action/Cancel.php b/inc/Action/Cancel.php
index c3e185534..d4d8277cd 100644
--- a/inc/Action/Cancel.php
+++ b/inc/Action/Cancel.php
@@ -13,7 +13,11 @@ use dokuwiki\Action\Exception\ActionAbort;
  */
 class Cancel extends AbstractAliasAction {
 
+    /** @inheritdoc */
     public function preProcess() {
+        global $ID;
+        unlock($ID);
+
         // continue with draftdel -> redirect -> show
         throw new ActionAbort('draftdel');
     }
diff --git a/inc/html.php b/inc/html.php
index a096102dc..fc55ffc12 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -1804,7 +1804,7 @@ function html_edit(){
         $form->addElement(form_makeOpenTag('div', array('class'=>'editButtons')));
         $form->addElement(form_makeButton('submit', 'save', $lang['btn_save'], array('id'=>'edbtn__save', 'accesskey'=>'s', 'tabindex'=>'4')));
         $form->addElement(form_makeButton('submit', 'preview', $lang['btn_preview'], array('id'=>'edbtn__preview', 'accesskey'=>'p', 'tabindex'=>'5')));
-        $form->addElement(form_makeButton('submit', 'draftdel', $lang['btn_cancel'], array('tabindex'=>'6')));
+        $form->addElement(form_makeButton('submit', 'cancel', $lang['btn_cancel'], array('tabindex'=>'6')));
         $form->addElement(form_makeCloseTag('div'));
         $form->addElement(form_makeOpenTag('div', array('class'=>'summary')));
         $form->addElement(form_makeTextField('summary', $SUM, $lang['summary'], 'edit__summary', 'nowrap', array('size'=>'50', 'tabindex'=>'2')));
-- 
GitLab