From: Jonny Tischbein Date: Sat, 17 Nov 2018 11:41:00 +0000 (+0100) Subject: Fix deleting last element from saved folder + Fix displaying empty saved folder X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=52eb2281e41b8493438d21b770572cdc9af8fcb2;p=friendica.git Fix deleting last element from saved folder + Fix displaying empty saved folder --- diff --git a/mod/filerm.php b/mod/filerm.php index 335b27b320..d8da0e1255 100644 --- a/mod/filerm.php +++ b/mod/filerm.php @@ -14,7 +14,7 @@ function filerm_content(App $a) } $term = XML::unescape(trim($_GET['term'])); - $cat = XML::unescape(trim($_GET['cat'])); + $cat = XML::unescape(trim(defaults($_GET, 'cat', ''))); $category = (($cat) ? true : false); @@ -25,12 +25,18 @@ function filerm_content(App $a) $item_id = (($a->argc > 1) ? intval($a->argv[1]) : 0); - Logger::log('filerm: tag ' . $term . ' item ' . $item_id); + Logger::log('filerm: tag ' . $term . ' item ' . $item_id . ' category ' . ($category ? 'true' : 'false')); if ($item_id && strlen($term)) { - FileTag::unsaveFile(local_user(), $item_id, $term, $category); + if (FileTag::unsaveFile(local_user(), $item_id, $term, $category)){ + info('Item removed'); + } + } + else { + info('Item was not deleted'); } + $a->internalRedirect('/network?f=&file=' . $term); killme(); } diff --git a/mod/network.php b/mod/network.php index 81a2f2b2ba..37c7b45286 100644 --- a/mod/network.php +++ b/mod/network.php @@ -346,6 +346,7 @@ function networkConversation(App $a, $items, Pager $pager, $mode, $update, $orde // Set this so that the conversation function can find out contact info for our wall-wall items $a->page_contact = $a->contact; + $items = (empty($items) ? [] : $items); $o = conversation($a, $items, $pager, $mode, $update, false, $ordering, local_user()); if (!$update) { diff --git a/src/Model/FileTag.php b/src/Model/FileTag.php index d3baffdd4f..b5c4cf2aef 100644 --- a/src/Model/FileTag.php +++ b/src/Model/FileTag.php @@ -290,7 +290,7 @@ class FileTag return false; } - $fields = ['file' => str_replace($pattern, '', $item['file'])]; + $fields = ['file' => str_replace($pattern, null, $item['file'])]; Item::update($fields, ['id' => $item_id]); $r = q("SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d", diff --git a/src/Model/Item.php b/src/Model/Item.php index 4a29e51d31..8e154b0834 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -911,7 +911,7 @@ class Item extends BaseObject } } - if (!empty($files)) { + if (!is_null($files)) { Term::insertFromFileFieldByItemId($item['id'], $files); if (!empty($item['file'])) { DBA::update('item', ['file' => ''], ['id' => $item['id']]);