From da2349bb6a85d13f0aa29046bef3021cf0c884ba Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 12 Feb 2015 17:45:25 -0800 Subject: provide relief to sites that are severely impacted by the slow ITEM_UNSEEN searches. This does not incorporate any other flag optimisations as that will require a major DB update and possibly involve significant downtime. This is just to bite off a little chunk now and provide some much needed relief. --- mod/network.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'mod/network.php') diff --git a/mod/network.php b/mod/network.php index 9a4707b4d..236d4c5e0 100644 --- a/mod/network.php +++ b/mod/network.php @@ -346,7 +346,7 @@ function network_content(&$a, $update = 0, $load = false) { else $page_mode = 'client'; - $simple_update = (($update) ? " and ( item.item_flags & " . intval(ITEM_UNSEEN) . " ) > 0 " : ''); + $simple_update = (($update) ? " and item.unseen = 1 " : ''); // This fixes a very subtle bug so I'd better explain it. You wake up in the morning or return after a day // or three and look at your matrix page - after opening up your browser. The first page loads just as it @@ -465,10 +465,7 @@ function network_content(&$a, $update = 0, $load = false) { } if(($update_unseen) && (! $firehose)) - $r = q("UPDATE item SET item_flags = ( item_flags & ~%d) - WHERE (item_flags & %d) > 0 AND uid = %d $update_unseen ", - intval(ITEM_UNSEEN), - intval(ITEM_UNSEEN), + $r = q("UPDATE item SET item_unseen = 0 where item_unseen = 1 AND uid = %d $update_unseen ", intval(local_channel()) ); -- cgit v1.2.3 From 084ca3f4a16084068a0ab04af651770142324f3a Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 12 Feb 2015 18:49:42 -0800 Subject: typo --- mod/network.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod/network.php') diff --git a/mod/network.php b/mod/network.php index 236d4c5e0..944c3c1d1 100644 --- a/mod/network.php +++ b/mod/network.php @@ -346,7 +346,7 @@ function network_content(&$a, $update = 0, $load = false) { else $page_mode = 'client'; - $simple_update = (($update) ? " and item.unseen = 1 " : ''); + $simple_update = (($update) ? " and item_unseen = 1 " : ''); // This fixes a very subtle bug so I'd better explain it. You wake up in the morning or return after a day // or three and look at your matrix page - after opening up your browser. The first page loads just as it -- cgit v1.2.3 From 26a414fe4b3ab4b1d995233f0402532ad41eaeb7 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 9 Mar 2015 16:25:55 -0700 Subject: make network page default options work more or less universally instead of just from the navbar, and fix some saved-search weirdness related to the delete-term icon --- mod/network.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'mod/network.php') diff --git a/mod/network.php b/mod/network.php index 944c3c1d1..161b06804 100644 --- a/mod/network.php +++ b/mod/network.php @@ -13,6 +13,12 @@ function network_init(&$a) { return; } + if(count($_GET) < 2) { + $network_options = get_pconfig(local_channel(),'system','network_page_default'); + if($network_options) + goaway('network' . '?f=&' . $network_options); + } + $channel = $a->get_channel(); $a->profile_uid = local_channel(); head_set_icon($channel['xchan_photo_s']); @@ -369,10 +375,13 @@ function network_content(&$a, $update = 0, $load = false) { // "New Item View" - show all items unthreaded in reverse created date order $items = q("SELECT item.*, item.id AS item_id, received FROM item + left join abook on item.author_xchan = abook.abook_xchan WHERE true $uids AND item_restrict = 0 + and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null) $simple_update $sql_extra $sql_nets - ORDER BY item.received DESC $pager_sql " + ORDER BY item.received DESC $pager_sql ", + intval(ABOOK_FLAG_BLOCKED) ); require_once('include/items.php'); -- cgit v1.2.3 From 9d1df58759b4eff9439c12d081ba5e1264f900a3 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 10 Mar 2015 18:55:56 -0700 Subject: sql optimisation for affinity searches. A new index was added which wasn't added retro-actively to existing DBs as an update. It isn't clear if this helps sites any more than just restricting the abook table to certain channel_id's is (and this field is already indexed). --- mod/network.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'mod/network.php') diff --git a/mod/network.php b/mod/network.php index 161b06804..d24d665d8 100644 --- a/mod/network.php +++ b/mod/network.php @@ -342,9 +342,11 @@ function network_content(&$a, $update = 0, $load = false) { $sys = get_sys_channel(); $uids = " and item.uid = " . intval($sys['channel_id']) . " "; $a->data['firehose'] = intval($sys['channel_id']); + $abook_uids = ""; } else { $uids = " and item.uid = " . local_channel() . " "; + $abook_uids = " and abook.abook_channel = " . local_channel() . " "; } if(get_pconfig(local_channel(),'system','network_list_mode')) @@ -376,7 +378,7 @@ function network_content(&$a, $update = 0, $load = false) { $items = q("SELECT item.*, item.id AS item_id, received FROM item left join abook on item.author_xchan = abook.abook_xchan - WHERE true $uids AND item_restrict = 0 + WHERE true $uids $abook_uids AND item_restrict = 0 and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null) $simple_update $sql_extra $sql_nets @@ -407,7 +409,7 @@ function network_content(&$a, $update = 0, $load = false) { $r = q("SELECT distinct item.id AS item_id, $ordering FROM item left join abook on item.author_xchan = abook.abook_xchan - WHERE true $uids AND item.item_restrict = 0 + WHERE true $uids $abook_uids AND item.item_restrict = 0 AND item.parent = item.id and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null) $sql_extra3 $sql_extra $sql_nets @@ -421,7 +423,7 @@ function network_content(&$a, $update = 0, $load = false) { // update $r = q("SELECT item.parent AS item_id FROM item left join abook on item.author_xchan = abook.abook_xchan - WHERE true $uids AND item.item_restrict = 0 $simple_update + WHERE true $uids $abook_uids AND item.item_restrict = 0 $simple_update and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null) $sql_extra3 $sql_extra $sql_nets ", intval(ABOOK_FLAG_BLOCKED) -- cgit v1.2.3 From 02a58dc5b05a39eee9784261c5010c0f1765588f Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 12 Mar 2015 16:20:29 -0700 Subject: more JS=1 weirdness --- mod/network.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod/network.php') diff --git a/mod/network.php b/mod/network.php index d24d665d8..b2888b223 100644 --- a/mod/network.php +++ b/mod/network.php @@ -13,7 +13,7 @@ function network_init(&$a) { return; } - if(count($_GET) < 2) { + if((count($_GET) < 2) || (count($_GET) < 3 && $_GET['JS'])) { $network_options = get_pconfig(local_channel(),'system','network_page_default'); if($network_options) goaway('network' . '?f=&' . $network_options); -- cgit v1.2.3 From 7d5efe88e0c97cea34d5290442d375c0cd609d34 Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 13 Mar 2015 15:39:19 -0700 Subject: use local_channel() connnections to match the abook against when joining the abook on the discover tab. --- mod/network.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mod/network.php') diff --git a/mod/network.php b/mod/network.php index b2888b223..691e860d7 100644 --- a/mod/network.php +++ b/mod/network.php @@ -337,16 +337,16 @@ function network_content(&$a, $update = 0, $load = false) { } + $abook_uids = " and abook.abook_channel = " . local_channel() . " "; + if($firehose && (! get_config('system','disable_discover_tab'))) { require_once('include/identity.php'); $sys = get_sys_channel(); $uids = " and item.uid = " . intval($sys['channel_id']) . " "; $a->data['firehose'] = intval($sys['channel_id']); - $abook_uids = ""; } else { $uids = " and item.uid = " . local_channel() . " "; - $abook_uids = " and abook.abook_channel = " . local_channel() . " "; } if(get_pconfig(local_channel(),'system','network_list_mode')) -- cgit v1.2.3 From e732fbe8e8a876ff76cbc7930a34f5adca4ffbd6 Mon Sep 17 00:00:00 2001 From: zottel Date: Sat, 14 Mar 2015 00:22:47 +0100 Subject: fix posts not showing up in network if author is not in connections --- mod/network.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'mod/network.php') diff --git a/mod/network.php b/mod/network.php index 691e860d7..642fc4f43 100644 --- a/mod/network.php +++ b/mod/network.php @@ -377,7 +377,7 @@ function network_content(&$a, $update = 0, $load = false) { // "New Item View" - show all items unthreaded in reverse created date order $items = q("SELECT item.*, item.id AS item_id, received FROM item - left join abook on item.author_xchan = abook.abook_xchan + left join abook on item.owner_xchan = abook.abook_xchan WHERE true $uids $abook_uids AND item_restrict = 0 and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null) $simple_update @@ -408,7 +408,7 @@ function network_content(&$a, $update = 0, $load = false) { // Fetch a page full of parent items for this page $r = q("SELECT distinct item.id AS item_id, $ordering FROM item - left join abook on item.author_xchan = abook.abook_xchan + left join abook on item.owner_xchan = abook.abook_xchan WHERE true $uids $abook_uids AND item.item_restrict = 0 AND item.parent = item.id and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null) @@ -422,7 +422,7 @@ function network_content(&$a, $update = 0, $load = false) { if(! $firehose) { // update $r = q("SELECT item.parent AS item_id FROM item - left join abook on item.author_xchan = abook.abook_xchan + left join abook on item.owner_xchan = abook.abook_xchan WHERE true $uids $abook_uids AND item.item_restrict = 0 $simple_update and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null) $sql_extra3 $sql_extra $sql_nets ", -- cgit v1.2.3 From b76cdf82d298c92bdf5a59b6bf6b55da504a46ea Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 13 Mar 2015 19:24:17 -0700 Subject: create terms for Diaspora mention tags - which in Diaspora are handled differently than other tag links and have to be done separately; they aren't processed by linkify_tags which handles all of our other tag processing. Also move the abook_channel clause in mod_network to the join statement. This works fine in mysql and achievies the desired result. I hope postgres can handle an expression as a join clause. --- mod/network.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'mod/network.php') diff --git a/mod/network.php b/mod/network.php index 642fc4f43..d2b9bc64c 100644 --- a/mod/network.php +++ b/mod/network.php @@ -377,8 +377,8 @@ function network_content(&$a, $update = 0, $load = false) { // "New Item View" - show all items unthreaded in reverse created date order $items = q("SELECT item.*, item.id AS item_id, received FROM item - left join abook on item.owner_xchan = abook.abook_xchan - WHERE true $uids $abook_uids AND item_restrict = 0 + left join abook on ( item.author_xchan = abook.abook_xchan $abook_uids ) + WHERE true $uids AND item_restrict = 0 and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null) $simple_update $sql_extra $sql_nets @@ -408,8 +408,8 @@ function network_content(&$a, $update = 0, $load = false) { // Fetch a page full of parent items for this page $r = q("SELECT distinct item.id AS item_id, $ordering FROM item - left join abook on item.owner_xchan = abook.abook_xchan - WHERE true $uids $abook_uids AND item.item_restrict = 0 + left join abook on ( item.author_xchan = abook.abook_xchan $abook_uids ) + WHERE true $uids AND item.item_restrict = 0 AND item.parent = item.id and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null) $sql_extra3 $sql_extra $sql_nets @@ -422,8 +422,8 @@ function network_content(&$a, $update = 0, $load = false) { if(! $firehose) { // update $r = q("SELECT item.parent AS item_id FROM item - left join abook on item.owner_xchan = abook.abook_xchan - WHERE true $uids $abook_uids AND item.item_restrict = 0 $simple_update + left join abook on ( item.author_xchan = abook.abook_xchan $abook_uids ) + WHERE true $uids AND item.item_restrict = 0 $simple_update and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null) $sql_extra3 $sql_extra $sql_nets ", intval(ABOOK_FLAG_BLOCKED) -- cgit v1.2.3 From 88167718baba7ea9aa1e2055a3071091877f9733 Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 14 Mar 2015 00:51:16 -0700 Subject: revert and rethink --- mod/network.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'mod/network.php') diff --git a/mod/network.php b/mod/network.php index d2b9bc64c..30e046462 100644 --- a/mod/network.php +++ b/mod/network.php @@ -377,7 +377,7 @@ function network_content(&$a, $update = 0, $load = false) { // "New Item View" - show all items unthreaded in reverse created date order $items = q("SELECT item.*, item.id AS item_id, received FROM item - left join abook on ( item.author_xchan = abook.abook_xchan $abook_uids ) + left join abook on item.owner_xchan = abook.abook_xchan WHERE true $uids AND item_restrict = 0 and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null) $simple_update @@ -408,7 +408,7 @@ function network_content(&$a, $update = 0, $load = false) { // Fetch a page full of parent items for this page $r = q("SELECT distinct item.id AS item_id, $ordering FROM item - left join abook on ( item.author_xchan = abook.abook_xchan $abook_uids ) + left join abook on item.owner_xchan = abook.abook_xchan WHERE true $uids AND item.item_restrict = 0 AND item.parent = item.id and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null) @@ -422,7 +422,7 @@ function network_content(&$a, $update = 0, $load = false) { if(! $firehose) { // update $r = q("SELECT item.parent AS item_id FROM item - left join abook on ( item.author_xchan = abook.abook_xchan $abook_uids ) + left join abook on item.owner_xchan = abook.abook_xchan WHERE true $uids AND item.item_restrict = 0 $simple_update and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null) $sql_extra3 $sql_extra $sql_nets ", -- cgit v1.2.3 From cc2c7bbcd89bf3b937b1248519d23bde1179190f Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 14 Mar 2015 01:03:37 -0700 Subject: revert the revert - that is working. My test was bad. --- mod/network.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'mod/network.php') diff --git a/mod/network.php b/mod/network.php index 30e046462..d2b9bc64c 100644 --- a/mod/network.php +++ b/mod/network.php @@ -377,7 +377,7 @@ function network_content(&$a, $update = 0, $load = false) { // "New Item View" - show all items unthreaded in reverse created date order $items = q("SELECT item.*, item.id AS item_id, received FROM item - left join abook on item.owner_xchan = abook.abook_xchan + left join abook on ( item.author_xchan = abook.abook_xchan $abook_uids ) WHERE true $uids AND item_restrict = 0 and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null) $simple_update @@ -408,7 +408,7 @@ function network_content(&$a, $update = 0, $load = false) { // Fetch a page full of parent items for this page $r = q("SELECT distinct item.id AS item_id, $ordering FROM item - left join abook on item.owner_xchan = abook.abook_xchan + left join abook on ( item.author_xchan = abook.abook_xchan $abook_uids ) WHERE true $uids AND item.item_restrict = 0 AND item.parent = item.id and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null) @@ -422,7 +422,7 @@ function network_content(&$a, $update = 0, $load = false) { if(! $firehose) { // update $r = q("SELECT item.parent AS item_id FROM item - left join abook on item.owner_xchan = abook.abook_xchan + left join abook on ( item.author_xchan = abook.abook_xchan $abook_uids ) WHERE true $uids AND item.item_restrict = 0 $simple_update and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null) $sql_extra3 $sql_extra $sql_nets ", -- cgit v1.2.3 From 629f6bec74bcc5f1bd6ea40bf020a8107bc54fb0 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 17 Mar 2015 15:45:08 -0700 Subject: ok it has to be owner. --- mod/network.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'mod/network.php') diff --git a/mod/network.php b/mod/network.php index d2b9bc64c..0eeeedbe9 100644 --- a/mod/network.php +++ b/mod/network.php @@ -377,7 +377,7 @@ function network_content(&$a, $update = 0, $load = false) { // "New Item View" - show all items unthreaded in reverse created date order $items = q("SELECT item.*, item.id AS item_id, received FROM item - left join abook on ( item.author_xchan = abook.abook_xchan $abook_uids ) + left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids ) WHERE true $uids AND item_restrict = 0 and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null) $simple_update @@ -408,7 +408,7 @@ function network_content(&$a, $update = 0, $load = false) { // Fetch a page full of parent items for this page $r = q("SELECT distinct item.id AS item_id, $ordering FROM item - left join abook on ( item.author_xchan = abook.abook_xchan $abook_uids ) + left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids ) WHERE true $uids AND item.item_restrict = 0 AND item.parent = item.id and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null) @@ -422,7 +422,7 @@ function network_content(&$a, $update = 0, $load = false) { if(! $firehose) { // update $r = q("SELECT item.parent AS item_id FROM item - left join abook on ( item.author_xchan = abook.abook_xchan $abook_uids ) + left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids ) WHERE true $uids AND item.item_restrict = 0 $simple_update and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null) $sql_extra3 $sql_extra $sql_nets ", -- cgit v1.2.3 From ead45292e134fa03726912905ca1ca58ccb12fec Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 21 Mar 2015 00:06:18 +0100 Subject: some tabs title statuseditor restructuring --- mod/network.php | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) (limited to 'mod/network.php') diff --git a/mod/network.php b/mod/network.php index 0eeeedbe9..7f8d39044 100644 --- a/mod/network.php +++ b/mod/network.php @@ -119,13 +119,16 @@ function network_content(&$a, $update = 0, $load = false) { if($cid) $def_acl = array('allow_cid' => '<' . intval($cid) . '>'); - if(! $update) { - $o .= network_tabs(); + $tabs = network_tabs(); + $o .= $tabs; // search terms header - if($search) - $o .= '

' . t('Search Results For:') . ' ' . htmlspecialchars($search, ENT_COMPAT,'UTF-8') . '

'; + if($search) { + $o .= replace_macros(get_markup_template("section_title.tpl"),array( + '$title' => t('Search Results For:') . ' ' . htmlspecialchars($search, ENT_COMPAT,'UTF-8') + )); + } nav_set_selected('network'); @@ -136,7 +139,6 @@ function network_content(&$a, $update = 0, $load = false) { 'deny_gid' => $channel['channel_deny_gid'] ); - $x = array( 'is_owner' => true, 'allow_location' => ((intval(get_pconfig($channel['channel_id'],'system','use_browser_location'))) ? '1' : ''), @@ -149,8 +151,8 @@ function network_content(&$a, $update = 0, $load = false) { 'profile_uid' => local_channel() ); - $o .= status_editor($a,$x); - + $status_editor = status_editor($a,$x); + $o .= $status_editor; } @@ -186,9 +188,15 @@ function network_content(&$a, $update = 0, $load = false) { $x = group_rec_byhash(local_channel(), $group_hash); - if($x) - $o = '

' . t('Collection: ') . $x['name'] . '

' . $o; + if($x) { + $title = replace_macros(get_markup_template("section_title.tpl"),array( + '$title' => t('Collection: ') . $x['name'] + )); + } + $o = $tabs; + $o .= $title; + $o .= $status_editor; } @@ -200,7 +208,12 @@ function network_content(&$a, $update = 0, $load = false) { ); if($r) { $sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND uid = " . intval(local_channel()) . " AND ( author_xchan = '" . dbesc($r[0]['abook_xchan']) . "' or owner_xchan = '" . dbesc($r[0]['abook_xchan']) . "' ) and item_restrict = 0 ) "; - $o = '

' . t('Connection: ') . $r[0]['xchan_name'] . '

' . $o; + $title = replace_macros(get_markup_template("section_title.tpl"),array( + '$title' => t('Connection: ') . $r[0]['xchan_name'] + )); + $o = $tabs; + $o .= $title; + $o .= $status_editor; } else { notice( t('Invalid connection.') . EOL); -- cgit v1.2.3 From 9980645ab8bf061decc36837ceea1dc5ead9f824 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 21 Mar 2015 13:37:55 +0100 Subject: fix acl for if we have an cid in /network and make $bang better visible --- mod/network.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'mod/network.php') diff --git a/mod/network.php b/mod/network.php index 7f8d39044..a145aca36 100644 --- a/mod/network.php +++ b/mod/network.php @@ -116,8 +116,21 @@ function network_content(&$a, $update = 0, $load = false) { if(x($_GET,'search') || x($_GET,'file')) $nouveau = true; - if($cid) - $def_acl = array('allow_cid' => '<' . intval($cid) . '>'); + if($cid) { + $r = q("SELECT abook_xchan FROM abook WHERE abook_id = %d AND abook_channel = %d LIMIT 1", + intval($cid), + intval(local_channel()) + ); + if(! $r) { + if($update) { + killme(); + } + notice( t('No such channel') . EOL ); + goaway($a->get_baseurl(true) . '/network'); + // NOTREACHED + } + $def_acl = array('allow_cid' => '<' . $r[0]['abook_xchan'] . '>'); + } if(! $update) { $tabs = network_tabs(); -- cgit v1.2.3 From a2e3ca6fd8ba8c0630de089d772fdd668b84428b Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 21 Mar 2015 16:46:28 -0700 Subject: add loadtime search to channel and fix it for home. display and search need further investigation --- mod/network.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'mod/network.php') diff --git a/mod/network.php b/mod/network.php index 7f8d39044..ecbeb4085 100644 --- a/mod/network.php +++ b/mod/network.php @@ -27,12 +27,13 @@ function network_init(&$a) { function network_content(&$a, $update = 0, $load = false) { - if(! local_channel()) { $_SESSION['return_url'] = $a->query_string; return login(false); } + if($load) + $_SESSION['loadtime'] = datetime_convert(); $arr = array('query' => $a->query_string); @@ -416,8 +417,6 @@ function network_content(&$a, $update = 0, $load = false) { if($load) { - $_SESSION['loadtime'] = datetime_convert(); - // Fetch a page full of parent items for this page $r = q("SELECT distinct item.id AS item_id, $ordering FROM item -- cgit v1.2.3 From 6631540d20068d3c4ee221518e8f430507662e27 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 22 Mar 2015 12:55:13 -0700 Subject: provide visual feedback when deleting a like by liking it again. --- mod/network.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'mod/network.php') diff --git a/mod/network.php b/mod/network.php index f71a7569a..0cf535769 100644 --- a/mod/network.php +++ b/mod/network.php @@ -396,7 +396,7 @@ function network_content(&$a, $update = 0, $load = false) { // which are both ITEM_UNSEEN and have "changed" since that time. Cross fingers... if($update && $_SESSION['loadtime']) - $simple_update .= " and item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' "; + $simple_update = " AND ( item_unseen = 1 or item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) "; if($load) $simple_update = ''; @@ -445,7 +445,7 @@ function network_content(&$a, $update = 0, $load = false) { } else { if(! $firehose) { - // update + // this is an update $r = q("SELECT item.parent AS item_id FROM item left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids ) WHERE true $uids AND item.item_restrict = 0 $simple_update @@ -453,6 +453,7 @@ function network_content(&$a, $update = 0, $load = false) { $sql_extra3 $sql_extra $sql_nets ", intval(ABOOK_FLAG_BLOCKED) ); + $_SESSION['loadtime'] = datetime_convert(); } } -- cgit v1.2.3 From 2bd19e6b51ff7331c04f23c0ab78f1e16b5a054e Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 22 Mar 2015 15:00:41 -0700 Subject: $simple_update isn't so simple any more. Make sure we don't re-itnroduce the bug that session['loadtime'] was created to fix. It's questionable whether we still need to even look for item_unseen but I won't make that call today. We can also eliminate the restriction on not doing live updates from the discover tab since we aren't relying completely on item_unseen (which can only be set by the owner and won't work on a page with virtual owners). --- mod/network.php | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'mod/network.php') diff --git a/mod/network.php b/mod/network.php index 0cf535769..8db3bfd58 100644 --- a/mod/network.php +++ b/mod/network.php @@ -396,7 +396,7 @@ function network_content(&$a, $update = 0, $load = false) { // which are both ITEM_UNSEEN and have "changed" since that time. Cross fingers... if($update && $_SESSION['loadtime']) - $simple_update = " AND ( item_unseen = 1 or item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) "; + $simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) "; if($load) $simple_update = ''; @@ -444,17 +444,15 @@ function network_content(&$a, $update = 0, $load = false) { } else { - if(! $firehose) { - // this is an update - $r = q("SELECT item.parent AS item_id FROM item - left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids ) - WHERE true $uids AND item.item_restrict = 0 $simple_update - and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null) - $sql_extra3 $sql_extra $sql_nets ", - intval(ABOOK_FLAG_BLOCKED) - ); - $_SESSION['loadtime'] = datetime_convert(); - } + // this is an update + $r = q("SELECT item.parent AS item_id FROM item + left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids ) + WHERE true $uids AND item.item_restrict = 0 $simple_update + and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null) + $sql_extra3 $sql_extra $sql_nets ", + intval(ABOOK_FLAG_BLOCKED) + ); + $_SESSION['loadtime'] = datetime_convert(); } // Then fetch all the children of the parents that are on this page -- cgit v1.2.3 From cbaa2a9b847bca5b7df4136d961058c7b459be98 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 30 Mar 2015 21:06:41 -0700 Subject: don't included any deleted posts in the self query --- mod/network.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod/network.php') diff --git a/mod/network.php b/mod/network.php index 8db3bfd58..d96c6830d 100644 --- a/mod/network.php +++ b/mod/network.php @@ -324,7 +324,7 @@ function network_content(&$a, $update = 0, $load = false) { } if($conv) { - $sql_extra .= sprintf(" AND parent IN (SELECT distinct(parent) from item where ( author_xchan like '%s' or ( item_flags & %d ) > 0)) ", + $sql_extra .= sprintf(" AND parent IN (SELECT distinct(parent) from item where ( author_xchan like '%s' or ( item_flags & %d ) > 0) and item_restrict = 0 ) ", dbesc(protect_sprintf($channel['channel_hash'])), intval(ITEM_MENTIONSME) ); -- cgit v1.2.3