From cf9c3444bc17a55438cfbac0e60b3dda35cd6956 Mon Sep 17 00:00:00 2001 From: Jonny Tischbein Date: Sat, 17 Nov 2018 13:56:58 +0100 Subject: [PATCH] Fix return url when delete comment from display --- include/items.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/items.php b/include/items.php index adc5bf0133..87f0a2d4e0 100644 --- a/include/items.php +++ b/include/items.php @@ -352,7 +352,7 @@ function drop_item($id, $return = '') // locate item to be deleted - $fields = ['id', 'uid', 'guid', 'contact-id', 'deleted']; + $fields = ['id', 'uid', 'guid', 'contact-id', 'deleted', 'gravity']; $item = Item::selectFirstForUser(local_user(), $fields, ['id' => $id]); if (!DBA::isResult($item)) { @@ -407,6 +407,8 @@ function drop_item($id, $return = '') $a->internalRedirect('display/' . $item['guid']); } + $is_comment = ($item['gravity'] == GRAVITY_COMMENT) ? true : false; + // delete the item Item::deleteForUser(['id' => $item['id']], local_user()); @@ -415,7 +417,8 @@ function drop_item($id, $return = '') // removes update_* from return_url to ignore Ajax refresh $return_url = str_replace("update_", "", $return_url); - if (empty($return_url) || strpos($return_url, 'display') !== false) { + // if unknown location or top level post called from display + if (empty($return_url) || ((strpos($return_url, 'display') !== false) AND (!$is_comment))) { $a->internalRedirect('network'); //NOTREACHED } -- 2.39.5