From 5c5fc0a62f892f20c2a5a21acf2932ef6a327ad7 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 15 Dec 2017 08:51:05 +0100 Subject: only use effective uid if we deal with sys channel content --- Zotlabs/Module/Hq.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Module/Hq.php') diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php index 073b67b92..1e46a6353 100644 --- a/Zotlabs/Module/Hq.php +++ b/Zotlabs/Module/Hq.php @@ -98,6 +98,8 @@ class Hq extends \Zotlabs\Web\Controller { $sys = get_sys_channel(); $sql_extra = item_permissions_sql($sys['channel_id']); + $sys_item = false; + } if(! $update) { @@ -215,6 +217,8 @@ class Hq extends \Zotlabs\Web\Controller { } if(!$r) { + $sys_item = true; + $r = q("SELECT item.id AS item_id FROM item LEFT JOIN abook ON item.author_xchan = abook.abook_xchan WHERE mid = '%s' AND item.uid = %d $item_normal @@ -243,6 +247,8 @@ class Hq extends \Zotlabs\Web\Controller { } if(!$r) { + $sys_item = true; + $r = q("SELECT item.parent AS item_id FROM item LEFT JOIN abook ON item.author_xchan = abook.abook_xchan WHERE mid = '%s' AND item.uid = %d $item_normal_update $simple_update @@ -268,7 +274,7 @@ class Hq extends \Zotlabs\Web\Controller { dbesc($parents_str) ); - xchan_query($items,true,local_channel()); + xchan_query($items,true,(($sys_item) ? local_channel() : 0)); $items = fetch_post_tags($items,true); $items = conv_sort($items,'created'); } -- cgit v1.2.3 From 25a63dc413cd51ce12deb1a87b0609e7829b0154 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 11 Jan 2018 10:58:46 +0100 Subject: continue working on hq --- Zotlabs/Module/Hq.php | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) (limited to 'Zotlabs/Module/Hq.php') diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php index 1e46a6353..ec3858471 100644 --- a/Zotlabs/Module/Hq.php +++ b/Zotlabs/Module/Hq.php @@ -51,8 +51,8 @@ class Hq extends \Zotlabs\Web\Controller { if(! $item_hash) { $r = q("SELECT mid FROM item - WHERE uid = %d - AND mid = parent_mid + WHERE uid = %d $item_normal + AND item_unseen = 1 ORDER BY created DESC LIMIT 1", intval(local_channel()) ); @@ -135,13 +135,11 @@ class Hq extends \Zotlabs\Web\Controller { $o = replace_macros(get_markup_template("hq.tpl"), [ '$no_messages' => (($target_item) ? false : true), - '$no_messages_label' => t('Welcome to hubzilla!') + '$no_messages_label' => [ t('Welcome to Hubzilla!'), t('You have got no unseen activity...') ], + '$editor' => status_editor($a,$x) ] ); - - $o = '
'; - $o .= status_editor($a,$x); - $o .= '
'; + } if(! $update && ! $load) { @@ -266,23 +264,20 @@ class Hq extends \Zotlabs\Web\Controller { } if($r) { - $parents_str = ids_to_querystr($r,'item_id'); - if($parents_str) { - $items = q("SELECT item.*, item.id AS item_id - FROM item - WHERE parent IN ( %s ) $item_normal ", - dbesc($parents_str) - ); + $items = q("SELECT item.*, item.id AS item_id + FROM item + WHERE parent = '%s' $item_normal ", + dbesc($r[0]['item_id']) + ); - xchan_query($items,true,(($sys_item) ? local_channel() : 0)); - $items = fetch_post_tags($items,true); - $items = conv_sort($items,'created'); - } + xchan_query($items,true,(($sys_item) ? local_channel() : 0)); + $items = fetch_post_tags($items,true); + $items = conv_sort($items,'created'); } else { $items = []; } - + $o .= conversation($items, 'hq', $update, 'client'); if($updateable) { -- cgit v1.2.3 From db08e2cea0703818b7f3515271d7603c78d1e648 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 12 Jan 2018 15:54:27 +0100 Subject: mod hq: stick to show latest unseen toplevel post on load --- Zotlabs/Module/Hq.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module/Hq.php') diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php index ec3858471..aa8293d5c 100644 --- a/Zotlabs/Module/Hq.php +++ b/Zotlabs/Module/Hq.php @@ -52,7 +52,7 @@ class Hq extends \Zotlabs\Web\Controller { if(! $item_hash) { $r = q("SELECT mid FROM item WHERE uid = %d $item_normal - AND item_unseen = 1 + AND mid = parent_ mid AND item_unseen = 1 ORDER BY created DESC LIMIT 1", intval(local_channel()) ); @@ -135,7 +135,7 @@ class Hq extends \Zotlabs\Web\Controller { $o = replace_macros(get_markup_template("hq.tpl"), [ '$no_messages' => (($target_item) ? false : true), - '$no_messages_label' => [ t('Welcome to Hubzilla!'), t('You have got no unseen activity...') ], + '$no_messages_label' => [ t('Welcome to Hubzilla!'), t('You have got no unseen posts...') ], '$editor' => status_editor($a,$x) ] ); -- cgit v1.2.3 From f2ec84fb138e056b2a49f0fcdf8fc0af05689a91 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 12 Jan 2018 16:03:41 +0100 Subject: typo --- Zotlabs/Module/Hq.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module/Hq.php') diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php index aa8293d5c..c169644db 100644 --- a/Zotlabs/Module/Hq.php +++ b/Zotlabs/Module/Hq.php @@ -52,7 +52,7 @@ class Hq extends \Zotlabs\Web\Controller { if(! $item_hash) { $r = q("SELECT mid FROM item WHERE uid = %d $item_normal - AND mid = parent_ mid AND item_unseen = 1 + AND mid = parent_mid AND item_unseen = 1 ORDER BY created DESC LIMIT 1", intval(local_channel()) ); -- cgit v1.2.3 From 2c5b6cf8dca239ab4ae85825e4593f8dba56cf74 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 12 Jan 2018 22:03:06 +0100 Subject: update to bootstrap 4 beta3 --- Zotlabs/Module/Hq.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module/Hq.php') diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php index c169644db..a9c3bb8e2 100644 --- a/Zotlabs/Module/Hq.php +++ b/Zotlabs/Module/Hq.php @@ -51,8 +51,8 @@ class Hq extends \Zotlabs\Web\Controller { if(! $item_hash) { $r = q("SELECT mid FROM item - WHERE uid = %d $item_normal - AND mid = parent_mid AND item_unseen = 1 + WHERE uid = %d + AND mid = parent_mid ORDER BY created DESC LIMIT 1", intval(local_channel()) ); -- cgit v1.2.3 From 2e4e56f7cc696b2c52014f0050294826caa74d7d Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 27 Jan 2018 22:23:47 +0100 Subject: if startpage is /hq redirect all notifications links to /hq and minor notifications and hq fixes --- Zotlabs/Module/Hq.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Zotlabs/Module/Hq.php') diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php index a9c3bb8e2..c305fdb3b 100644 --- a/Zotlabs/Module/Hq.php +++ b/Zotlabs/Module/Hq.php @@ -29,6 +29,8 @@ class Hq extends \Zotlabs\Web\Controller { ); } + killme(); + } function get($update = 0, $load = false) { -- cgit v1.2.3 From a86b260f736cd7298d5d160c658bb9405ad3f69f Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 28 Jan 2018 12:09:47 +0100 Subject: query optimisations for notifications - use a specific index only --- Zotlabs/Module/Hq.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module/Hq.php') diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php index c305fdb3b..c46695b65 100644 --- a/Zotlabs/Module/Hq.php +++ b/Zotlabs/Module/Hq.php @@ -51,9 +51,11 @@ class Hq extends \Zotlabs\Web\Controller { $item_normal = item_normal(); $item_normal_update = item_normal_update(); + $use_index = db_use_index('created'); + if(! $item_hash) { - $r = q("SELECT mid FROM item - WHERE uid = %d + $r = q("SELECT mid FROM item $use_index + WHERE uid = %d $item_normal AND mid = parent_mid ORDER BY created DESC LIMIT 1", intval(local_channel()) -- cgit v1.2.3 From 3cc756f3029e5f3b02008dac94a90e168d398c9a Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 4 Feb 2018 20:42:40 +0100 Subject: remove some never used indices which prevented our item queries to find the right query execution plan in mysql and adjust some queries to optimze the result --- Zotlabs/Module/Hq.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'Zotlabs/Module/Hq.php') diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php index c46695b65..baeba82e8 100644 --- a/Zotlabs/Module/Hq.php +++ b/Zotlabs/Module/Hq.php @@ -51,10 +51,8 @@ class Hq extends \Zotlabs\Web\Controller { $item_normal = item_normal(); $item_normal_update = item_normal_update(); - $use_index = db_use_index('created'); - if(! $item_hash) { - $r = q("SELECT mid FROM item $use_index + $r = q("SELECT mid FROM item WHERE uid = %d $item_normal AND mid = parent_mid ORDER BY created DESC LIMIT 1", -- cgit v1.2.3