diff options
author | Mario <mario@mariovavti.com> | 2024-11-28 15:34:16 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2024-11-28 15:34:16 +0000 |
commit | 428ffa5e35346c2d1e29cec9624a5a9dc7007a36 (patch) | |
tree | 0dda07ec8b156f8255feabf62b477e95462f3144 /Zotlabs/Module | |
parent | 0bffe6e01974ea30ae4d9749fdb2be37690faf0c (diff) | |
download | volse-hubzilla-428ffa5e35346c2d1e29cec9624a5a9dc7007a36.tar.gz volse-hubzilla-428ffa5e35346c2d1e29cec9624a5a9dc7007a36.tar.bz2 volse-hubzilla-428ffa5e35346c2d1e29cec9624a5a9dc7007a36.zip |
save a loop by ordering results by item_wall and more uuid only lookup
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r-- | Zotlabs/Module/Conversation.php | 3 | ||||
-rw-r--r-- | Zotlabs/Module/Item.php | 15 |
2 files changed, 9 insertions, 9 deletions
diff --git a/Zotlabs/Module/Conversation.php b/Zotlabs/Module/Conversation.php index c3e6ae5ec..6ceba69f2 100644 --- a/Zotlabs/Module/Conversation.php +++ b/Zotlabs/Module/Conversation.php @@ -36,8 +36,7 @@ class Conversation extends Controller { // do we have the item (at all)? - $r = q("select parent_mid from item where mid = '%s' or uuid = '%s' $item_normal order by item_wall desc limit 1", - dbesc(z_root() . '/item/' . $item_id), + $r = q("select parent_mid from item where uuid = '%s' $item_normal order by item_wall desc limit 1", dbesc($item_id) ); diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index c0e59633b..97ccb312e 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -53,20 +53,21 @@ class Item extends Controller { if (argc() > 1 && argv(1) !== 'drop') { - $x = q("select uid, item_wall, llink, uuid from item where uuid = '%s'", + $x = q("select uid, item_wall, llink, uuid from item where uuid = '%s' order by item_wall desc", dbesc(argv(1)) ); + if ($x) { - foreach ($x as $xv) { - if (intval($xv['item_wall'])) { - $c = channelx_by_n($xv['uid']); - if ($c) { - goaway(z_root() . '/channel/' . $c['channel_address'] . '?mid=' . $xv['uuid']); - } + if ($x[0]['item_wall']) { + $c = channelx_by_n($x[0]['uid']); + if ($c) { + goaway(z_root() . '/channel/' . $c['channel_address'] . '?mid=' . $x[0]['uuid']); } } + goaway($x[0]['llink']); } + http_status_exit(404, 'Not found'); } |