mod hq: minor query change

This commit is contained in:
Mario Vavti 2017-11-24 22:48:15 +01:00
parent 64c81ed174
commit b03545f899

View File

@ -43,10 +43,9 @@ class Hq extends \Zotlabs\Web\Controller {
$item_normal_update = item_normal_update(); $item_normal_update = item_normal_update();
if(! $item_hash) { if(! $item_hash) {
$r = q("SELECT mid FROM item $r = q("SELECT mid FROM item
WHERE uid = %d WHERE uid = %d
AND item_thread_top = 1 AND mid = parent_mid
ORDER BY created DESC ORDER BY created DESC
limit 1", limit 1",
intval(local_channel()) intval(local_channel())
@ -64,13 +63,13 @@ class Hq extends \Zotlabs\Web\Controller {
if(strpos($item_hash,'b64.') === 0) if(strpos($item_hash,'b64.') === 0)
$decoded = @base64url_decode(substr($item_hash,4)); $decoded = @base64url_decode(substr($item_hash,4));
if($decoded) if($decoded)
$item_hash = $decoded; $item_hash = $decoded;
$updateable = false; $updateable = false;
if(! $update) { if(! $update) {
$channel = \App::get_channel(); $channel = \App::get_channel();
$channel_acl = [ $channel_acl = [
@ -139,7 +138,6 @@ class Hq extends \Zotlabs\Web\Controller {
$static = ((local_channel()) ? channel_manual_conv_update(local_channel()) : 1); $static = ((local_channel()) ? channel_manual_conv_update(local_channel()) : 1);
// if the target item is not a post (eg a like) we want to address its thread parent // if the target item is not a post (eg a like) we want to address its thread parent
$mid = ((($target_item['verb'] == ACTIVITY_LIKE) || ($target_item['verb'] == ACTIVITY_DISLIKE)) ? $target_item['thr_parent'] : $target_item['mid']); $mid = ((($target_item['verb'] == ACTIVITY_LIKE) || ($target_item['verb'] == ACTIVITY_DISLIKE)) ? $target_item['thr_parent'] : $target_item['mid']);
// if we got a decoded hash we must encode it again before handing to javascript // if we got a decoded hash we must encode it again before handing to javascript
@ -180,11 +178,9 @@ class Hq extends \Zotlabs\Web\Controller {
'$net' => '', '$net' => '',
'$mid' => $mid '$mid' => $mid
]); ]);
} }
if($load) { if($load) {
$r = null; $r = null;
$r = q("SELECT item.id as item_id from item $r = q("SELECT item.id as item_id from item
@ -198,11 +194,8 @@ class Hq extends \Zotlabs\Web\Controller {
if($r) { if($r) {
$updateable = true; $updateable = true;
} }
} }
elseif($update) { elseif($update) {
$r = null; $r = null;
$r = q("SELECT item.parent AS item_id from item $r = q("SELECT item.parent AS item_id from item
@ -220,7 +213,6 @@ class Hq extends \Zotlabs\Web\Controller {
$_SESSION['loadtime'] = datetime_convert(); $_SESSION['loadtime'] = datetime_convert();
} }
else { else {
$r = []; $r = [];
} }