From e14ed2ce350306fb9989d23e66da64add1927711 Mon Sep 17 00:00:00 2001
From: Michael <heluecht@pirati.ca>
Date: Sat, 7 Mar 2020 23:19:19 +0000
Subject: [PATCH] Issue 8151: Automatic Friend is working again

---
 src/Model/Contact.php | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/Model/Contact.php b/src/Model/Contact.php
index 68bd0986a..e4f142e3a 100644
--- a/src/Model/Contact.php
+++ b/src/Model/Contact.php
@@ -2653,8 +2653,17 @@ class Contact
 					]);
 				}
 			} elseif (DBA::isResult($user) && in_array($user['page-flags'], [User::PAGE_FLAGS_SOAPBOX, User::PAGE_FLAGS_FREELOVE, User::PAGE_FLAGS_COMMUNITY])) {
+				if (($user['page-flags'] == User::PAGE_FLAGS_FREELOVE) && ($network != Protocol::DIASPORA)) {
+					self::createFromProbe($importer['uid'], $url, false, $network);
+				}
+
 				$condition = ['uid' => $importer['uid'], 'url' => $url, 'pending' => true];
-				DBA::update('contact', ['pending' => false], $condition);
+				$fields = ['pending' => false];
+				if ($user['page-flags'] == User::PAGE_FLAGS_FREELOVE) {
+					$fields['rel'] = Contact::FRIEND;
+				}
+
+				DBA::update('contact', $fields, $condition);
 
 				return true;
 			}