From 18a5cc691629006ac7cee53f835d83dc40bb85b8 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 22 Feb 2020 20:19:42 -0500 Subject: [PATCH 01/43] Test for the existence of the precise parsed url part in BoundariesPager - Address https://github.com/friendica/friendica/issues/8000#issuecomment-587138376 --- src/Content/BoundariesPager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Content/BoundariesPager.php b/src/Content/BoundariesPager.php index b8b7f67bb..8bbbde2b4 100644 --- a/src/Content/BoundariesPager.php +++ b/src/Content/BoundariesPager.php @@ -57,7 +57,7 @@ class BoundariesPager extends Pager $this->last_item_id = $last_item_id; $parsed = parse_url($this->getBaseQueryString()); - if ($parsed) { + if (!empty($parsed['query'])) { parse_str($parsed['query'], $queryParameters); $this->first_page = !($queryParameters['since_id'] ?? null) && !($queryParameters['max_id'] ?? null); From b2bfec3381136c76702e079d612dacfddde01a79 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 22 Feb 2020 20:30:28 -0500 Subject: [PATCH 02/43] Remove unused template variable in mod/photos --- mod/photos.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/mod/photos.php b/mod/photos.php index 951126155..3f959a6c2 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -1372,7 +1372,6 @@ function photos_content(App $a) $likebuttons = ''; $comments = ''; $paginate = ''; - $responses = ''; if (!empty($link_item['id']) && !empty($link_item['uri'])) { $cmnt_tpl = Renderer::getMarkupTemplate('comment_item.tpl'); @@ -1460,7 +1459,6 @@ function photos_content(App $a) foreach ($items as $item) { $comment = ''; $template = $tpl; - $sparkle = ''; $activity = DI::activity(); @@ -1523,8 +1521,6 @@ function photos_content(App $a) } } - $responses = get_responses($conv_responses, ['like', 'dislike'], $link_item); - $paginate = $pager->renderFull($total); } @@ -1544,7 +1540,6 @@ function photos_content(App $a) '$likebuttons' => $likebuttons, '$like' => $like, '$dislike' => $dislike, - 'responses' => $responses, '$comments' => $comments, '$paginate' => $paginate, ]); From 452d7e6404121eb86900cffdb6baeef3a6558e53 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 22 Feb 2020 20:41:12 -0500 Subject: [PATCH 03/43] Remove unused conversation response code - Remove get_responses() - Remove get_response_button_text() - Remove title key from $conv_responses array - Address https://github.com/friendica/friendica/issues/8000#issuecomment-589263329 --- include/conversation.php | 64 ++++------------------------------------ mod/photos.php | 10 +++---- src/Object/Post.php | 10 ++++--- src/Object/Thread.php | 1 + 4 files changed, 17 insertions(+), 68 deletions(-) diff --git a/include/conversation.php b/include/conversation.php index f29e6d325..02b1b7340 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -579,12 +579,11 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o $items = $cb['items']; $conv_responses = [ - 'like' => ['title' => DI::l10n()->t('Likes','title')], - 'dislike' => ['title' => DI::l10n()->t('Dislikes','title')], - 'attendyes' => ['title' => DI::l10n()->t('Attending','title')], - 'attendno' => ['title' => DI::l10n()->t('Not attending','title')], - 'attendmaybe' => ['title' => DI::l10n()->t('Might attend','title')], - 'announce' => ['title' => DI::l10n()->t('Reshares','title')] + 'like' => [], + 'dislike' => [], + 'attendyes' => [], + 'attendno' => [], + 'attendmaybe' => [] ]; if (DI::pConfig()->get(local_user(), 'system', 'hide_dislike')) { @@ -1572,56 +1571,3 @@ function render_location_dummy(array $item) { return $item['coord']; } } - -function get_responses(array $conv_responses, array $response_verbs, array $item, Post $ob = null) { - $ret = []; - foreach ($response_verbs as $v) { - $ret[$v] = []; - $ret[$v]['count'] = $conv_responses[$v][$item['uri']] ?? 0; - $ret[$v]['list'] = $conv_responses[$v][$item['uri'] . '-l'] ?? []; - $ret[$v]['self'] = $conv_responses[$v][$item['uri'] . '-self'] ?? '0'; - if (count($ret[$v]['list']) > MAX_LIKERS) { - $ret[$v]['list_part'] = array_slice($ret[$v]['list'], 0, MAX_LIKERS); - array_push($ret[$v]['list_part'], '' . DI::l10n()->t('View all') . ''); - } else { - $ret[$v]['list_part'] = ''; - } - $ret[$v]['button'] = get_response_button_text($v, $ret[$v]['count']); - $ret[$v]['title'] = $conv_responses[$v]['title']; - } - - $count = 0; - foreach ($ret as $key) { - if ($key['count'] == true) { - $count++; - } - } - $ret['count'] = $count; - - return $ret; -} - -function get_response_button_text($v, $count) -{ - $return = ''; - switch ($v) { - case 'like': - $return = DI::l10n()->tt('Like', 'Likes', $count); - break; - case 'dislike': - $return = DI::l10n()->tt('Dislike', 'Dislikes', $count); - break; - case 'attendyes': - $return = DI::l10n()->tt('Attending', 'Attending', $count); - break; - case 'attendno': - $return = DI::l10n()->tt('Not Attending', 'Not Attending', $count); - break; - case 'attendmaybe': - $return = DI::l10n()->tt('Undecided', 'Undecided', $count); - break; - } - - return $return; -} diff --git a/mod/photos.php b/mod/photos.php index 3f959a6c2..0c94471c0 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -1412,11 +1412,11 @@ function photos_content(App $a) } $conv_responses = [ - 'like' => ['title' => DI::l10n()->t('Likes','title')], - 'dislike' => ['title' => DI::l10n()->t('Dislikes','title')], - 'attendyes' => ['title' => DI::l10n()->t('Attending','title')], - 'attendno' => ['title' => DI::l10n()->t('Not attending','title')], - 'attendmaybe' => ['title' => DI::l10n()->t('Might attend','title')] + 'like' => [], + 'dislike' => [], + 'attendyes' => [], + 'attendno' => [], + 'attendmaybe' => [] ]; if (DI::pConfig()->get(local_user(), 'system', 'hide_dislike')) { diff --git a/src/Object/Post.php b/src/Object/Post.php index c92c5a32b..384c88a6d 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -272,10 +272,12 @@ class Post } } - $responses = get_responses($conv_responses, $response_verbs, $item, $this); - - foreach ($response_verbs as $value => $verbs) { - $responses[$verbs]['output'] = !empty($conv_responses[$verbs][$item['uri']]) ? format_like($conv_responses[$verbs][$item['uri']], $conv_responses[$verbs][$item['uri'] . '-l'], $verbs, $item['uri']) : ''; + $responses = []; + foreach ($response_verbs as $value => $verb) { + $responses[$verb] = [ + 'self' => $conv_responses[$verb][$item['uri'] . '-self'] ?? 0, + 'output' => !empty($conv_responses[$verb][$item['uri']]) ? format_like($conv_responses[$verb][$item['uri']], $conv_responses[$verb][$item['uri'] . '-l'], $verb, $item['uri']) : '', + ]; } /* diff --git a/src/Object/Thread.php b/src/Object/Thread.php index b574e300b..f62b14c71 100644 --- a/src/Object/Thread.php +++ b/src/Object/Thread.php @@ -34,6 +34,7 @@ use Friendica\Util\Security; */ class Thread { + /** @var Post[] */ private $parents = []; private $mode = null; private $writable = false; From 699b567d978e39b1c39a34a1ca082ff56edfbcc7 Mon Sep 17 00:00:00 2001 From: Andy Date: Sun, 23 Feb 2020 03:31:59 +0000 Subject: [PATCH 04/43] modified: src/Module/Admin/Users.php --- src/Module/Admin/Users.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Module/Admin/Users.php b/src/Module/Admin/Users.php index b446a2c47..f5e2d5ed3 100644 --- a/src/Module/Admin/Users.php +++ b/src/Module/Admin/Users.php @@ -283,7 +283,7 @@ class Users extends BaseAdmin } } - $th_users = array_map(null, [DI::l10n()->t('Name'), DI::l10n()->t('Email'), DI::l10n()->t('Register date'), DI::l10n()->t('Last login'), DI::l10n()->t('Last item'), DI::l10n()->t('Type')], $valid_orders); + $th_users = array_map(null, [DI::l10n()->t('Name'), DI::l10n()->t('Email'), DI::l10n()->t('Register date'), DI::l10n()->t('Last login'), DI::l10n()->t('Last public item'), DI::l10n()->t('Type')], $valid_orders); $t = Renderer::getMarkupTemplate('admin/users.tpl'); $o = Renderer::replaceMacros($t, [ @@ -308,7 +308,7 @@ class Users extends BaseAdmin '$h_users' => DI::l10n()->t('Users'), '$h_newuser' => DI::l10n()->t('New User'), - '$th_deleted' => [DI::l10n()->t('Name'), DI::l10n()->t('Email'), DI::l10n()->t('Register date'), DI::l10n()->t('Last login'), DI::l10n()->t('Last item'), DI::l10n()->t('Permanent deletion')], + '$th_deleted' => [DI::l10n()->t('Name'), DI::l10n()->t('Email'), DI::l10n()->t('Register date'), DI::l10n()->t('Last login'), DI::l10n()->t('Last public item'), DI::l10n()->t('Permanent deletion')], '$th_users' => $th_users, '$order_users' => $order, '$order_direction_users' => $order_direction, From e94911620aa38b3210e0334506fbb6822f405b28 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 23 Feb 2020 19:38:24 -0500 Subject: [PATCH 05/43] Expand system.no_auto_update to community, profile statuses and contact conversations pages - Update setting name and description --- mod/update_contact.php | 2 +- src/Module/Settings/Display.php | 2 +- src/Module/Update/Community.php | 5 ++++- src/Module/Update/Profile.php | 8 ++++++-- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/mod/update_contact.php b/mod/update_contact.php index 5fb62e6a0..4863ad02d 100644 --- a/mod/update_contact.php +++ b/mod/update_contact.php @@ -28,7 +28,7 @@ use Friendica\Module\Contact; function update_contact_content(App $a) { - if ($_GET["force"] == 1) { + if (!empty($_GET['force']) || !DI::pConfig()->get(local_user(), 'system', 'no_auto_update')) { $text = Contact::content([], true); } else { $text = ''; diff --git a/src/Module/Settings/Display.php b/src/Module/Settings/Display.php index 644453756..bde049718 100644 --- a/src/Module/Settings/Display.php +++ b/src/Module/Settings/Display.php @@ -197,7 +197,7 @@ class Display extends BaseSettings '$itemspage_network' => ['itemspage_network' , DI::l10n()->t('Number of items to display per page:'), $itemspage_network, DI::l10n()->t('Maximum of 100 items')], '$itemspage_mobile_network' => ['itemspage_mobile_network', DI::l10n()->t('Number of items to display per page when viewed from mobile device:'), $itemspage_mobile_network, DI::l10n()->t('Maximum of 100 items')], '$ajaxint' => ['browser_update' , DI::l10n()->t('Update browser every xx seconds'), $browser_update, DI::l10n()->t('Minimum of 10 seconds. Enter -1 to disable it.')], - '$no_auto_update' => ['no_auto_update' , DI::l10n()->t('Automatic updates only at the top of the network page'), $no_auto_update, DI::l10n()->t('When disabled, the network page is updated all the time, which could be confusing while reading.')], + '$no_auto_update' => ['no_auto_update' , DI::l10n()->t('Automatic updates only at the top of the post stream pages'), $no_auto_update, DI::l10n()->t('Auto update may add new posts at the top of the post stream pages, which can affect the scroll position and perturb normal reading if it happens anywhere else the top of the page.')], '$nosmile' => ['nosmile' , DI::l10n()->t('Don\'t show emoticons'), $nosmile, DI::l10n()->t('Normally emoticons are replaced with matching symbols. This setting disables this behaviour.')], '$infinite_scroll' => ['infinite_scroll' , DI::l10n()->t('Infinite scroll'), $infinite_scroll, DI::l10n()->t('Automatic fetch new items when reaching the page end.')], '$no_smart_threading' => ['no_smart_threading' , DI::l10n()->t('Disable Smart Threading'), $no_smart_threading, DI::l10n()->t('Disable the automatic suppression of extraneous thread indentation.')], diff --git a/src/Module/Update/Community.php b/src/Module/Update/Community.php index e0bc6c067..b064b4e86 100644 --- a/src/Module/Update/Community.php +++ b/src/Module/Update/Community.php @@ -37,7 +37,10 @@ class Community extends CommunityModule { self::parseRequest($parameters); - $o = conversation(DI::app(), self::getItems(), 'community', true, false, 'commented', local_user()); + $o = ''; + if (!empty($_GET['force']) || !DI::pConfig()->get(local_user(), 'system', 'no_auto_update')) { + $o = conversation(DI::app(), self::getItems(), 'community', true, false, 'commented', local_user()); + } System::htmlUpdateExit($o); } diff --git a/src/Module/Update/Profile.php b/src/Module/Update/Profile.php index 662042eb1..38ef3b09e 100644 --- a/src/Module/Update/Profile.php +++ b/src/Module/Update/Profile.php @@ -42,8 +42,6 @@ class Profile extends BaseModule throw new ForbiddenException(); } - $o = ''; - $profile_uid = intval($_GET['p'] ?? 0); // Ensure we've got a profile owner if updating. @@ -57,6 +55,12 @@ class Profile extends BaseModule throw new ForbiddenException(DI::l10n()->t('Access to this profile has been restricted.')); } + $o = ''; + + if (empty($_GET['force']) && DI::pConfig()->get(local_user(), 'system', 'no_auto_update')) { + System::htmlUpdateExit($o); + } + // Get permissions SQL - if $remote_contact is true, our remote user has been pre-verified and we already have fetched his/her groups $sql_extra = Item::getPermissionsSQLByUserId($a->profile['uid']); From e230619a84c8323e31e1b616c7d2b601f5d2a5b6 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 23 Feb 2020 20:20:20 -0500 Subject: [PATCH 06/43] Move actions dropdown in search item view --- view/theme/frio/templates/search_item.tpl | 142 +++++++++++++--------- 1 file changed, 82 insertions(+), 60 deletions(-) diff --git a/view/theme/frio/templates/search_item.tpl b/view/theme/frio/templates/search_item.tpl index 6c2b81516..1cbd8451d 100644 --- a/view/theme/frio/templates/search_item.tpl +++ b/view/theme/frio/templates/search_item.tpl @@ -11,65 +11,18 @@
{{* Put additional actions in a top-right dropdown menu *}} - +
+ {{if $item.network_icon != ""}} + + {{else}} + {{$item.network_name}} + {{/if}} + {{if $item.plink}} {{*link to the original source of the item *}} + + + + {{/if}} +
{{* The avatar picture and the photo-menu *}} {{/if}} {{if $item.remote_comment}} - + {{/if}} {{if $item.plink}} - + {{/if}} {{if $item.edpost}} diff --git a/view/templates/widget_forumlist.tpl b/view/templates/widget_forumlist.tpl index 01f61d603..1d35b1948 100644 --- a/view/templates/widget_forumlist.tpl +++ b/view/templates/widget_forumlist.tpl @@ -24,7 +24,7 @@ function showHideForumlist() { {{if $forum.id <= $visible_forums}}
diff --git a/view/theme/quattro/templates/widget_forumlist.tpl b/view/theme/quattro/templates/widget_forumlist.tpl index 35c54bc69..7cc4bc280 100644 --- a/view/theme/quattro/templates/widget_forumlist.tpl +++ b/view/theme/quattro/templates/widget_forumlist.tpl @@ -21,7 +21,7 @@ function showHideForumlist() { {{if $forum.id <= $visible_forums}}