From 05a5e1792d27184d29e0c78fd9c61334232a507e Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 10 Apr 2017 22:09:49 -0400 Subject: [PATCH 01/18] Left trim at sign from nicks in ACL --- include/acl_selectors.php | 12 ++++++------ mod/acl.php | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/acl_selectors.php b/include/acl_selectors.php index f4b644d68..8404c8f4b 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -627,14 +627,14 @@ function acl_lookup(App $a, $out_type = 'json') { dbesc($search), implode("','", $known_contacts) ); - if (dbm::is_result($r)){ + if (dbm::is_result($r)) { foreach ($r as $row) { - // nickname.. $up = parse_url($row['author-link']); - $nick = explode("/",$up['path']); - $nick = $nick[count($nick)-1]; - $nick .= "@".$up['host']; - // /nickname + $nick = explode('/', $up['path']); + // Fix for Mastodon URLs with format https://domain.tld/@nick + $nick = ltrim($nick[count($nick) - 1], '@'); + $nick .= '@' . $up['host']; + $unknow_contacts[] = array( 'type' => 'c', 'photo' => proxy_url($row['author-avatar'], false, PROXY_SIZE_MICRO), diff --git a/mod/acl.php b/mod/acl.php index 04aa9f50a..9220bc77a 100644 --- a/mod/acl.php +++ b/mod/acl.php @@ -1,7 +1,7 @@ Date: Mon, 10 Apr 2017 22:10:05 -0400 Subject: [PATCH 02/18] Add network for unknown contacts in ACL --- include/acl_selectors.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/acl_selectors.php b/include/acl_selectors.php index 8404c8f4b..2a435c8e7 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -615,7 +615,7 @@ function acl_lookup(App $a, $out_type = 'json') { function _contact_link($i){ return dbesc($i['link']); } $known_contacts = array_map(_contact_link, $contacts); $unknow_contacts=array(); - $r = q("SELECT `author-avatar`,`author-name`,`author-link` + $r = q("SELECT `author-avatar`,`author-name`,`author-link`, `network` FROM `item` WHERE `parent` = %d AND (`author-name` LIKE '%%%s%%' OR `author-link` LIKE '%%%s%%') AND `author-link` NOT IN ('%s') @@ -640,7 +640,7 @@ function acl_lookup(App $a, $out_type = 'json') { 'photo' => proxy_url($row['author-avatar'], false, PROXY_SIZE_MICRO), 'name' => htmlentities($row['author-name']), 'id' => '', - 'network' => 'unknown', + 'network' => $row['network'], 'link' => $row['author-link'], 'nick' => htmlentities($nick), 'forum' => false From 762e8eda7a7d314ce74180831a3f3bfe7b2dbe96 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Tue, 11 Apr 2017 02:41:19 -0400 Subject: [PATCH 03/18] Use get_contact_details_by_url for unknown contacts - Fix typo - Fix comment - Fix closure --- include/acl_selectors.php | 46 ++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/include/acl_selectors.php b/include/acl_selectors.php index 2a435c8e7..4036886c4 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -610,12 +610,18 @@ function acl_lookup(App $a, $out_type = 'json') { $items = array_merge($groups, $contacts); if ($conv_id) { - /* if $conv_id is set, get unknow contacts in thread */ - /* but first get know contacts url to filter them out */ - function _contact_link($i){ return dbesc($i['link']); } - $known_contacts = array_map(_contact_link, $contacts); - $unknow_contacts=array(); - $r = q("SELECT `author-avatar`,`author-name`,`author-link`, `network` + /* + * if $conv_id is set, get unknown contacts in thread + * but first get known contacts url to filter them out + */ + $known_contacts = array_map( + function ($i) { + return dbesc($i['link']); + } + , $contacts); + + $unknown_contacts = array(); + $r = q("SELECT `author-link` FROM `item` WHERE `parent` = %d AND (`author-name` LIKE '%%%s%%' OR `author-link` LIKE '%%%s%%') AND `author-link` NOT IN ('%s') @@ -625,31 +631,27 @@ function acl_lookup(App $a, $out_type = 'json') { intval($conv_id), dbesc($search), dbesc($search), - implode("','", $known_contacts) + implode("', '", $known_contacts) ); if (dbm::is_result($r)) { foreach ($r as $row) { - $up = parse_url($row['author-link']); - $nick = explode('/', $up['path']); - // Fix for Mastodon URLs with format https://domain.tld/@nick - $nick = ltrim($nick[count($nick) - 1], '@'); - $nick .= '@' . $up['host']; + $contact = get_contact_details_by_url($row['author-link'], 0); - $unknow_contacts[] = array( - 'type' => 'c', - 'photo' => proxy_url($row['author-avatar'], false, PROXY_SIZE_MICRO), - 'name' => htmlentities($row['author-name']), - 'id' => '', - 'network' => $row['network'], - 'link' => $row['author-link'], - 'nick' => htmlentities($nick), + $unknown_contacts[] = array( + 'type' => 'cu', + 'photo' => proxy_url($contact['micro'], false, PROXY_SIZE_MICRO), + 'name' => htmlentities($contact['name']), + 'id' => intval($contact['id']), + 'network' => $contact['network'], + 'link' => $contact['url'], + 'nick' => $contact['nick'], 'forum' => false ); } } - $items = array_merge($items, $unknow_contacts); - $tot += count($unknow_contacts); + $items = array_merge($items, $unknown_contacts); + $tot += count($unknown_contacts); } $results = array( From 6b8ad57399e46eef6db713861f74a6fbddf587e8 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Tue, 11 Apr 2017 21:18:34 -0400 Subject: [PATCH 04/18] Add error handling for missing contacts --- include/acl_selectors.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/include/acl_selectors.php b/include/acl_selectors.php index 4036886c4..0e30ee06e 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -637,16 +637,18 @@ function acl_lookup(App $a, $out_type = 'json') { foreach ($r as $row) { $contact = get_contact_details_by_url($row['author-link'], 0); - $unknown_contacts[] = array( - 'type' => 'cu', - 'photo' => proxy_url($contact['micro'], false, PROXY_SIZE_MICRO), - 'name' => htmlentities($contact['name']), - 'id' => intval($contact['id']), - 'network' => $contact['network'], - 'link' => $contact['url'], - 'nick' => $contact['nick'], - 'forum' => false - ); + if (count($contact) > 0) { + $unknown_contacts[] = array( + 'type' => 'cu', + 'photo' => proxy_url($contact['micro'], false, PROXY_SIZE_MICRO), + 'name' => htmlentities($contact['name']), + 'id' => intval($contact['id']), + 'network' => $contact['network'], + 'link' => $contact['url'], + 'nick' => $contact['nick'], + 'forum' => false + ); + } } } From b8e4094e7b475dd5ab980134ea463902c718a4aa Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 12 Apr 2017 23:09:22 +0200 Subject: [PATCH 05/18] Allow negative contact.contat-type https://github.com/friendica/friendica/issues/3328 --- database.sql | 2 +- include/dbstructure.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/database.sql b/database.sql index 7ed19f439..9d5695710 100644 --- a/database.sql +++ b/database.sql @@ -159,7 +159,7 @@ CREATE TABLE IF NOT EXISTS `contact` ( `writable` tinyint(1) NOT NULL DEFAULT 0, `forum` tinyint(1) NOT NULL DEFAULT 0, `prv` tinyint(1) NOT NULL DEFAULT 0, - `contact-type` int(11) unsigned NOT NULL DEFAULT 0, + `contact-type` int(11) NOT NULL DEFAULT 0, `hidden` tinyint(1) NOT NULL DEFAULT 0, `archive` tinyint(1) NOT NULL DEFAULT 0, `pending` tinyint(1) NOT NULL DEFAULT 1, diff --git a/include/dbstructure.php b/include/dbstructure.php index 48cc02d2d..9828230a1 100644 --- a/include/dbstructure.php +++ b/include/dbstructure.php @@ -5,7 +5,7 @@ use \Friendica\Core\Config; require_once("boot.php"); require_once("include/text.php"); -define('NEW_UPDATE_ROUTINE_VERSION', 1170); +define('NEW_UPDATE_ROUTINE_VERSION', 1171); /* * send the email and do what is needed to do on update fails @@ -671,7 +671,7 @@ function db_definition($charset) { "writable" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"), "forum" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"), "prv" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"), - "contact-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"), + "contact-type" => array("type" => "int(11)", "not null" => "1", "default" => "0"), "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"), "archive" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"), "pending" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"), From 325d3afe183a397ea6688480c1b2df8e1be99dc1 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 12 Apr 2017 23:14:33 +0200 Subject: [PATCH 06/18] Bump DB version --- boot.php | 2 +- include/dbstructure.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/boot.php b/boot.php index 070dcf726..ed4fe10a3 100644 --- a/boot.php +++ b/boot.php @@ -38,7 +38,7 @@ define ( 'FRIENDICA_PLATFORM', 'Friendica'); define ( 'FRIENDICA_CODENAME', 'Asparagus'); define ( 'FRIENDICA_VERSION', '3.5.2-dev' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); -define ( 'DB_UPDATE_VERSION', 1216 ); +define ( 'DB_UPDATE_VERSION', 1217 ); /** * @brief Constant with a HTML line break. diff --git a/include/dbstructure.php b/include/dbstructure.php index 9828230a1..406ad6c93 100644 --- a/include/dbstructure.php +++ b/include/dbstructure.php @@ -5,7 +5,7 @@ use \Friendica\Core\Config; require_once("boot.php"); require_once("include/text.php"); -define('NEW_UPDATE_ROUTINE_VERSION', 1171); +define('NEW_UPDATE_ROUTINE_VERSION', 1170); /* * send the email and do what is needed to do on update fails From 92361a0209da085e1bed4de56ce46f755175142a Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 12 Apr 2017 23:20:10 +0200 Subject: [PATCH 07/18] Bump update version --- update.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update.php b/update.php index 8404f5bf2..4e945d209 100644 --- a/update.php +++ b/update.php @@ -1,6 +1,6 @@ Date: Wed, 12 Apr 2017 21:32:06 -0400 Subject: [PATCH 08/18] Fiddling with the unknown contact array values --- include/acl_selectors.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/acl_selectors.php b/include/acl_selectors.php index 0e30ee06e..4cc810fb5 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -635,18 +635,18 @@ function acl_lookup(App $a, $out_type = 'json') { ); if (dbm::is_result($r)) { foreach ($r as $row) { - $contact = get_contact_details_by_url($row['author-link'], 0); + $contact = get_contact_details_by_url($row['author-link']); if (count($contact) > 0) { $unknown_contacts[] = array( 'type' => 'cu', 'photo' => proxy_url($contact['micro'], false, PROXY_SIZE_MICRO), 'name' => htmlentities($contact['name']), - 'id' => intval($contact['id']), + 'id' => intval($contact['cid']), 'network' => $contact['network'], 'link' => $contact['url'], - 'nick' => $contact['nick'], - 'forum' => false + 'nick' => $contact['nick'] ? : $contact['addr'], + 'forum' => $contact['forum'] ); } } From d82684219a861ad25ade416cf95f85c2cc8a8217 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 13 Apr 2017 04:51:16 +0000 Subject: [PATCH 09/18] Issue 3331: Removed unneeded table "deliverq" --- mod/admin.php | 5 +---- view/templates/admin_summary.tpl | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/mod/admin.php b/mod/admin.php index e86bb90dd..2652b33c1 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -474,9 +474,6 @@ function admin_page_summary(App $a) { $r = qu("SELECT COUNT(`id`) AS `count` FROM `register`"); $pending = $r[0]['count']; - $r = qu("SELECT COUNT(*) AS `total` FROM `deliverq` WHERE 1"); - $deliverq = (($r) ? $r[0]['total'] : 0); - $r = qu("SELECT COUNT(*) AS `total` FROM `queue` WHERE 1"); $queue = (($r) ? $r[0]['total'] : 0); @@ -485,7 +482,7 @@ function admin_page_summary(App $a) { // We can do better, but this is a quick queue status - $queues = array('label' => t('Message queues'), 'deliverq' => $deliverq, 'queue' => $queue, 'workerq' => $workerqueue); + $queues = array('label' => t('Message queues'), 'queue' => $queue, 'workerq' => $workerqueue); $t = get_markup_template("admin_summary.tpl"); diff --git a/view/templates/admin_summary.tpl b/view/templates/admin_summary.tpl index a8243b614..e65014413 100644 --- a/view/templates/admin_summary.tpl +++ b/view/templates/admin_summary.tpl @@ -11,7 +11,7 @@
{{$queues.label}}
-
{{$queues.deliverq}} - {{$queues.queue}} - {{$queues.workerq}}
+
{{$queues.queue}} - {{$queues.workerq}}
{{$pending.0}}
From f399a1914f5e349dc2ae38f8a9b66b4135f4be3d Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 13 Apr 2017 05:08:12 +0000 Subject: [PATCH 10/18] Removed documentation --- doc/database/db_deliverq.md | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 doc/database/db_deliverq.md diff --git a/doc/database/db_deliverq.md b/doc/database/db_deliverq.md deleted file mode 100644 index 533589957..000000000 --- a/doc/database/db_deliverq.md +++ /dev/null @@ -1,12 +0,0 @@ -Table deliverq -============== - -| Field | Description | Type | Null | Key | Default | Extra | -|---------|------------------|------------------|------|-----|---------|----------------| -| id | sequential ID | int(10) unsigned | NO | PRI | NULL | auto_increment | -| cmd | | varchar(32) | NO | | | | -| item | | int(11) | NO | | 0 | | -| contact | | int(11) | NO | | 0 | | - - -Return to [database documentation](help/database) From 2b3a12948051c6171226b20614c9e762a07a1eeb Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 13 Apr 2017 05:08:42 +0000 Subject: [PATCH 11/18] Removed it here as well --- doc/database.md | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/database.md b/doc/database.md index f48404c17..4c6150520 100644 --- a/doc/database.md +++ b/doc/database.md @@ -14,7 +14,6 @@ Database Tables | [config](help/database/db_config) | main configuration storage | | [contact](help/database/db_contact) | contact table | | [conv](help/database/db_conv) | private messages | -| [deliverq](help/database/db_deliverq) | | | [event](help/database/db_event) | Events | | [fcontact](help/database/db_fcontact) | friend suggestion stuff | | [ffinder](help/database/db_ffinder) | friend suggestion stuff | From 31f9b418ba3d37ae32f3c0ccda53563e08b21a5d Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Wed, 12 Apr 2017 23:16:44 +0200 Subject: [PATCH 12/18] Scroll to next/previous thread when pressing j/k (fixes #3327) --- js/main.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/js/main.js b/js/main.js index 556e4ed8c..98c219d78 100644 --- a/js/main.js +++ b/js/main.js @@ -322,6 +322,29 @@ } }); + $(document).keydown(function (event) { + var threads = $('.thread_level_1'); + if ((event.keyCode === 74 || event.keyCode === 75) && !$(event.target).is('textarea, input')) { + var scrollTop = $(window).scrollTop(); + if (event.keyCode === 75) { + threads = $(threads.get().reverse()); + } + threads.each(function(key, item) { + var comparison; + var top = $(item).offset().top - 100; + if (event.keyCode === 74) { + comparison = top > scrollTop + 1; + } else if (event.keyCode === 75) { + comparison = top < scrollTop - 1; + } + if (comparison) { + $('html, body').animate({ scrollTop: top }, 200); + return false; + } + }); + } + }); + // Set an event listener for infinite scroll if(typeof infinite_scroll !== 'undefined') { $(window).scroll(function(e){ From ead9cbe534d3c520957d72b543004c0fcce70c87 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Thu, 13 Apr 2017 02:24:27 +0200 Subject: [PATCH 13/18] Web app manifest (fixes #3317) --- mod/manifest.php | 26 ++++++++++++++++++++++++++ view/templates/head.tpl | 1 + view/templates/manifest.tpl | 9 +++++++++ view/theme/frio/templates/head.tpl | 1 + 4 files changed, 37 insertions(+) create mode 100644 mod/manifest.php create mode 100644 view/templates/manifest.tpl diff --git a/mod/manifest.php b/mod/manifest.php new file mode 100644 index 000000000..6dc0d10a2 --- /dev/null +++ b/mod/manifest.php @@ -0,0 +1,26 @@ + App::get_baseurl(), + '$touch_icon' => $touch_icon, + '$title' => Config::get('config', 'sitename', 'Friendica'), + )); + + echo $o; + + killme(); + + } +?> diff --git a/view/templates/head.tpl b/view/templates/head.tpl index bfc5728ed..e7df8a18c 100644 --- a/view/templates/head.tpl +++ b/view/templates/head.tpl @@ -19,6 +19,7 @@ +