aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2018-09-20 23:34:44 +0200
committerGitHub <noreply@github.com>2018-09-20 23:34:44 +0200
commita4fbe88b6d007094fa395b17802e593ecca0588b (patch)
treeebbb08270fd77d3dec447054fb65801a2b28a625
parentbede8e1b633d720d6a7d1b05ba367811f3ac2b87 (diff)
parent4fa9a3c5d83a1024678596a586afe5df14a345b5 (diff)
downloadShaarli-a4fbe88b6d007094fa395b17802e593ecca0588b.tar.gz
Shaarli-a4fbe88b6d007094fa395b17802e593ecca0588b.tar.zst
Shaarli-a4fbe88b6d007094fa395b17802e593ecca0588b.zip
Merge pull request #1215 from ArthurHoaro/hotfix/tag-deletion
Fix a JS bug preventing AJAX tag deletion to work
-rw-r--r--assets/default/js/base.js2
-rw-r--r--index.php3
2 files changed, 3 insertions, 2 deletions
diff --git a/assets/default/js/base.js b/assets/default/js/base.js
index 8bf79d3e..1b8d8c36 100644
--- a/assets/default/js/base.js
+++ b/assets/default/js/base.js
@@ -548,7 +548,7 @@ function init(description) {
548 event.preventDefault(); 548 event.preventDefault();
549 const block = findParent(event.target, 'div', { class: 'tag-list-item' }); 549 const block = findParent(event.target, 'div', { class: 'tag-list-item' });
550 const tag = block.getAttribute('data-tag'); 550 const tag = block.getAttribute('data-tag');
551 const refreshedToken = document.getElementById('token'); 551 const refreshedToken = document.getElementById('token').value;
552 552
553 if (confirm(`Are you sure you want to delete the tag "${tag}"?`)) { 553 if (confirm(`Are you sure you want to delete the tag "${tag}"?`)) {
554 const xhr = new XMLHttpRequest(); 554 const xhr = new XMLHttpRequest();
diff --git a/index.php b/index.php
index 8f6ee50a..eb717536 100644
--- a/index.php
+++ b/index.php
@@ -1084,7 +1084,8 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager,
1084 die(t('Wrong token.')); 1084 die(t('Wrong token.'));
1085 } 1085 }
1086 1086
1087 $alteredLinks = $LINKSDB->renameTag(escape($_POST['fromtag']), escape($_POST['totag'])); 1087 $toTag = isset($_POST['totag']) ? escape($_POST['totag']) : null;
1088 $alteredLinks = $LINKSDB->renameTag(escape($_POST['fromtag']), $toTag);
1088 $LINKSDB->save($conf->get('resource.page_cache')); 1089 $LINKSDB->save($conf->get('resource.page_cache'));
1089 foreach ($alteredLinks as $link) { 1090 foreach ($alteredLinks as $link) {
1090 $history->updateLink($link); 1091 $history->updateLink($link);