From 4c089a1f878c7c73068215ef632aef8bcee3cc69 Mon Sep 17 00:00:00 2001
From: Michael <heluecht@pirati.ca>
Date: Fri, 31 Jul 2020 17:58:25 +0000
Subject: [PATCH 1/4] "gcign" is removed

---
 database.sql                  | 13 +-------
 mod/suggest.php               | 57 +++--------------------------------
 static/dbstructure.config.php | 15 +--------
 3 files changed, 7 insertions(+), 78 deletions(-)

diff --git a/database.sql b/database.sql
index ea89847c19..3f15af1a44 100644
--- a/database.sql
+++ b/database.sql
@@ -144,6 +144,7 @@ CREATE TABLE IF NOT EXISTS `contact` (
 	 INDEX `dfrn-id` (`dfrn-id`(64)),
 	 INDEX `issued-id` (`issued-id`(64)),
 	 INDEX `network_uid_lastupdate` (`network`,`uid`,`last-update`),
+	 INDEX `uid_lastitem` (`uid`,`last-item`),
 	 INDEX `gsid` (`gsid`),
 	FOREIGN KEY (`gsid`) REFERENCES `gserver` (`id`) ON UPDATE RESTRICT ON DELETE RESTRICT
 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='contact table';
@@ -464,18 +465,6 @@ CREATE TABLE IF NOT EXISTS `fsuggest` (
 	 PRIMARY KEY(`id`)
 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='friend suggestion stuff';
 
---
--- TABLE gcign
---
-CREATE TABLE IF NOT EXISTS `gcign` (
-	`id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
-	`uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Local User id',
-	`gcid` int unsigned NOT NULL DEFAULT 0 COMMENT 'gcontact.id of ignored contact',
-	 PRIMARY KEY(`id`),
-	 INDEX `uid` (`uid`),
-	 INDEX `gcid` (`gcid`)
-) DEFAULT COLLATE utf8mb4_general_ci COMMENT='contacts ignored by friend suggestions';
-
 --
 -- TABLE gcontact
 --
diff --git a/mod/suggest.php b/mod/suggest.php
index d501e3a3f2..192f59d910 100644
--- a/mod/suggest.php
+++ b/mod/suggest.php
@@ -26,31 +26,12 @@ use Friendica\Database\DBA;
 use Friendica\DI;
 use Friendica\Model\Contact;
 use Friendica\Module\Contact as ModuleContact;
-
-function suggest_init(App $a)
-{
-	if (! local_user()) {
-		return;
-	}
-}
-
-function suggest_post(App $a)
-{
-	if (!empty($_POST['ignore']) && !empty($_POST['confirm'])) {
-		DBA::insert('gcign', ['uid' => local_user(), 'gcid' => $_POST['ignore']]);
-		notice(DI::l10n()->t('Contact suggestion successfully ignored.'));
-	}
-
-	DI::baseUrl()->redirect('suggest');
-}
+use Friendica\Network\HTTPException;
 
 function suggest_content(App $a)
 {
-	$o = '';
-
-	if (! local_user()) {
-		notice(DI::l10n()->t('Permission denied.'));
-		return;
+	if (!local_user()) {
+		throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
 	}
 
 	$_SESSION['return_path'] = DI::args()->getCommand();
@@ -58,35 +39,9 @@ function suggest_content(App $a)
 	DI::page()['aside'] .= Widget::findPeople();
 	DI::page()['aside'] .= Widget::follow();
 
-
 	$contacts = Contact::getSuggestions(local_user());
 	if (!DBA::isResult($contacts)) {
-		$o .= DI::l10n()->t('No suggestions available. If this is a new site, please try again in 24 hours.');
-		return $o;
-	}
-
-
-	if (!empty($_GET['ignore'])) {
-		// <form> can't take arguments in its "action" parameter
-		// so add any arguments as hidden inputs
-		$query = explode_querystring(DI::args()->getQueryString());
-		$inputs = [];
-		foreach ($query['args'] as $arg) {
-			if (strpos($arg, 'confirm=') === false) {
-				$arg_parts = explode('=', $arg);
-				$inputs[] = ['name' => $arg_parts[0], 'value' => $arg_parts[1]];
-			}
-		}
-
-		return Renderer::replaceMacros(Renderer::getMarkupTemplate('confirm.tpl'), [
-			'$method' => 'post',
-			'$message' => DI::l10n()->t('Do you really want to delete this suggestion?'),
-			'$extra_inputs' => $inputs,
-			'$confirm' => DI::l10n()->t('Yes'),
-			'$confirm_url' => $query['base'],
-			'$confirm_name' => 'confirm',
-			'$cancel' => DI::l10n()->t('Cancel'),
-		]);
+		return DI::l10n()->t('No suggestions available. If this is a new site, please try again in 24 hours.');
 	}
 
 	$entries = [];
@@ -96,10 +51,8 @@ function suggest_content(App $a)
 
 	$tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl');
 
-	$o .= Renderer::replaceMacros($tpl,[
+	return Renderer::replaceMacros($tpl,[
 		'$title' => DI::l10n()->t('Friend Suggestions'),
 		'$contacts' => $entries,
 	]);
-
-	return $o;
 }
diff --git a/static/dbstructure.config.php b/static/dbstructure.config.php
index e9f70bec20..8287ecd4e7 100755
--- a/static/dbstructure.config.php
+++ b/static/dbstructure.config.php
@@ -54,7 +54,7 @@
 use Friendica\Database\DBA;
 
 if (!defined('DB_UPDATE_VERSION')) {
-	define('DB_UPDATE_VERSION', 1358);
+	define('DB_UPDATE_VERSION', 1359);
 }
 
 return [
@@ -538,19 +538,6 @@ return [
 			"PRIMARY" => ["id"],
 		]
 	],
-	"gcign" => [
-		"comment" => "contacts ignored by friend suggestions",
-		"fields" => [
-			"id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
-			"uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Local User id"],
-			"gcid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["gcontact" => "id"], "comment" => "gcontact.id of ignored contact"],
-		],
-		"indexes" => [
-			"PRIMARY" => ["id"],
-			"uid" => ["uid"],
-			"gcid" => ["gcid"],
-		]
-	],
 	"gcontact" => [
 		"comment" => "global contacts",
 		"fields" => [

From 86c924b820e7560356ee6695bd44ed6f5c0a5022 Mon Sep 17 00:00:00 2001
From: Michael <heluecht@pirati.ca>
Date: Fri, 31 Jul 2020 18:59:41 +0000
Subject: [PATCH 2/4] Fix description

---
 src/Worker/UpdateServerDirectory.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Worker/UpdateServerDirectory.php b/src/Worker/UpdateServerDirectory.php
index 87bbee7e8c..c23d01c5ac 100644
--- a/src/Worker/UpdateServerDirectory.php
+++ b/src/Worker/UpdateServerDirectory.php
@@ -28,9 +28,9 @@ class UpdateServerDirectory
 {
 	/**
 	 * Query the given server for their users
-	 * @param string $gserver Server URL
+	 * @param array $gserver Server record
 	 */
-	public static function execute($gserver)
+	public static function execute(array $gserver)
 	{
 		GServer::updateDirectory($gserver);
 		return;

From 5b8961a88e8f173129ea99cfe089bd6bf2809657 Mon Sep 17 00:00:00 2001
From: Michael <heluecht@pirati.ca>
Date: Fri, 31 Jul 2020 19:00:34 +0000
Subject: [PATCH 3/4] Removed unused stuff

---
 src/Worker/UpdateServerDirectory.php | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/Worker/UpdateServerDirectory.php b/src/Worker/UpdateServerDirectory.php
index c23d01c5ac..11455b795f 100644
--- a/src/Worker/UpdateServerDirectory.php
+++ b/src/Worker/UpdateServerDirectory.php
@@ -21,7 +21,6 @@
 
 namespace Friendica\Worker;
 
-use Friendica\Core\Logger;
 use Friendica\Model\GServer;
 
 class UpdateServerDirectory
@@ -33,6 +32,5 @@ class UpdateServerDirectory
 	public static function execute(array $gserver)
 	{
 		GServer::updateDirectory($gserver);
-		return;
 	}
 }

From 29762119927168bd75732bb2c22f675ca3359a99 Mon Sep 17 00:00:00 2001
From: Michael <heluecht@pirati.ca>
Date: Sat, 1 Aug 2020 09:26:41 +0000
Subject: [PATCH 4/4] Add "Nextcloud" to the statisrics

---
 src/Module/Admin/Federation.php | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/Module/Admin/Federation.php b/src/Module/Admin/Federation.php
index fd60b07152..aef8aa7493 100644
--- a/src/Module/Admin/Federation.php
+++ b/src/Module/Admin/Federation.php
@@ -42,6 +42,7 @@ class Federation extends BaseAdmin
 			'hubzilla'    => ['name' => 'Hubzilla/Red Matrix', 'color' => '#43488a'], // blue from the logo
 			'mastodon'    => ['name' => 'Mastodon', 'color' => '#1a9df9'], // blue from the Mastodon logo
 			'misskey'     => ['name' => 'Misskey', 'color' => '#ccfefd'], // Font color of the homepage
+			'nextcloud'   => ['name' => 'Nextcloud', 'color' => '#1cafff'], // Logo color
 			'peertube'    => ['name' => 'Peertube', 'color' => '#ffad5c'], // One of the logo colors
 			'pixelfed'    => ['name' => 'Pixelfed', 'color' => '#11da47'], // One of the logo colors
 			'pleroma'     => ['name' => 'Pleroma', 'color' => '#E46F0F'], // Orange from the text that is used on Pleroma instances