From: Jonny Tischbein Date: Thu, 25 Oct 2018 21:57:26 +0000 (+0200) Subject: Redirect to previous page after NON-AJAX Post delete via second parameter in /item... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b66bcb20daf65b6c988db75319363ed550041510;p=friendica.git Redirect to previous page after NON-AJAX Post delete via second parameter in /item/drop --- diff --git a/include/items.php b/include/items.php index 887bbb5b68..6eb1345889 100644 --- a/include/items.php +++ b/include/items.php @@ -345,7 +345,7 @@ function drop_items(array $items) } } -function drop_item($id) +function drop_item($id, $return) { $a = BaseObject::getApp(); @@ -409,8 +409,16 @@ function drop_item($id) // delete the item Item::deleteForUser(['id' => $item['id']], local_user()); - $a->internalRedirect('network'); - //NOTREACHED + $return_url = hex2bin($return); + notice("RETURN: " + $return_url); + if (empty($return_url) || strpos($return_url, 'display') ) { + $a->internalRedirect('network'); + //NOTREACHED + } + else { + $a->internalRedirect($return_url); + //NOTREACHED + } } else { notice(L10n::t('Permission denied.') . EOL); $a->internalRedirect('display/' . $item['guid']); diff --git a/mod/item.php b/mod/item.php index c7dbfd21c6..2aaa3a38f0 100644 --- a/mod/item.php +++ b/mod/item.php @@ -881,11 +881,11 @@ function item_content(App $a) $o = ''; - if (($a->argc == 3) && ($a->argv[1] === 'drop') && intval($a->argv[2])) { + if (($a->argc >= 3) && ($a->argv[1] === 'drop') && intval($a->argv[2])) { if ($a->isAjax()) { $o = Item::deleteForUser(['id' => $a->argv[2]], local_user()); } else { - $o = drop_item($a->argv[2]); + $o = drop_item($a->argv[2], $a->argv[3]); } if ($a->isAjax()) { diff --git a/src/Object/Post.php b/src/Object/Post.php index 086b78960a..e2c1ea03c3 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -414,6 +414,7 @@ class Post extends BaseObject 'received' => $item['received'], 'commented' => $item['commented'], 'created_date' => $item['created'], + 'return' => ($a->cmd) ? bin2hex($a->cmd) : '', ]; $arr = ['item' => $item, 'output' => $tmp_item]; diff --git a/view/theme/frio/templates/wall_thread.tpl b/view/theme/frio/templates/wall_thread.tpl index 53efacda70..c46fc339dd 100644 --- a/view/theme/frio/templates/wall_thread.tpl +++ b/view/theme/frio/templates/wall_thread.tpl @@ -141,7 +141,7 @@ as the value of $top_child_total (this is done at the end of this file) {{if $item.drop.dropping}}
  • - +
  • {{/if}}