From 26ed71cc14a9c8a11e659591b0d7cac02cdbdee1 Mon Sep 17 00:00:00 2001 From: Jonny Tischbein Date: Tue, 23 Oct 2018 13:38:31 +0200 Subject: [PATCH] Only perform Term::deleteAllTags when needed + not needed redirect --- mod/tagrm.php | 3 --- src/Model/Item.php | 5 +++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/mod/tagrm.php b/mod/tagrm.php index 4bdaeb32f1..8497bc28a6 100644 --- a/mod/tagrm.php +++ b/mod/tagrm.php @@ -71,9 +71,6 @@ function update_tags($item_id, $tags){ Item::update(['tag' => $tag_str], ['id' => $item_id]); info(L10n::t('Tag(s) removed') . EOL ); - $a->internalRedirect($_SESSION['photo_return']); - - // NOTREACHED } function tagrm_content(App $a) diff --git a/src/Model/Item.php b/src/Model/Item.php index 9b016295ee..3df2429313 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -896,14 +896,15 @@ class Item extends BaseObject } if (!is_null($tags)) { - Term::deleteAllTags($item['id']); - if ($tags) { Term::insertFromTagFieldByItemId($item['id'], $tags); if (!empty($item['tag'])) { DBA::update('item', ['tag' => ''], ['id' => $item['id']]); } } + else { + Term::deleteAllTags($item['id']); + } } if (!empty($files)) {