]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
Fix a JS bug preventing AJAX tag deletion to work 1215/head
authorArthurHoaro <arthur@hoa.ro>
Thu, 16 Aug 2018 15:25:47 +0000 (17:25 +0200)
committerArthurHoaro <arthur@hoa.ro>
Thu, 16 Aug 2018 15:25:47 +0000 (17:25 +0200)
Fixes #1214

assets/default/js/base.js
index.php

index 8bf79d3e4c612efac7e815ca421b3c2acff14023..1b8d8c36fa33d603a78232495e6e612d92eb6879 100644 (file)
@@ -548,7 +548,7 @@ function init(description) {
       event.preventDefault();
       const block = findParent(event.target, 'div', { class: 'tag-list-item' });
       const tag = block.getAttribute('data-tag');
-      const refreshedToken = document.getElementById('token');
+      const refreshedToken = document.getElementById('token').value;
 
       if (confirm(`Are you sure you want to delete the tag "${tag}"?`)) {
         const xhr = new XMLHttpRequest();
index 8f6ee50affaf45f69c0d169f4b4f36901af5f1ba..eb717536c58f33d8b8a63b7933765c075d364b35 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1084,7 +1084,8 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager,
             die(t('Wrong token.'));
         }
 
-        $alteredLinks = $LINKSDB->renameTag(escape($_POST['fromtag']), escape($_POST['totag']));
+        $toTag = isset($_POST['totag']) ? escape($_POST['totag']) : null;
+        $alteredLinks = $LINKSDB->renameTag(escape($_POST['fromtag']), $toTag);
         $LINKSDB->save($conf->get('resource.page_cache'));
         foreach ($alteredLinks as $link) {
             $history->updateLink($link);