From 4b858650ced0d7648a3545a9da2c67a09222ccc6 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sat, 5 Sep 2015 12:11:14 +0200 Subject: [PATCH] Check if the author should be ignored when fetching missing posts --- include/diaspora.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/include/diaspora.php b/include/diaspora.php index c874ded4a7..24d4d45da6 100644 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -975,9 +975,21 @@ function diaspora_store_by_guid($guid, $server, $uid = 0) { $person = find_diaspora_person_by_handle($author); + $contact_id = get_contact($person['url'], $uid); + + $contacts = q("SELECT * FROM `contact` WHERE `id` = %d", intval($contact_id)); + $importers = q("SELECT * FROM `user` WHERE `uid` = %d", intval($uid)); + + if ($contacts AND $importers) + if(!diaspora_post_allow($importers[0],$contacts[0], false)) { + logger('Ignoring author '.$person['url'].' for uid '.$uid); + return false; + } else + logger('Author '.$person['url'].' is allowed for uid '.$uid); + $datarray = array(); $datarray['uid'] = $uid; - $datarray['contact-id'] = get_contact($person['url'], $uid); + $datarray['contact-id'] = $contact_id; $datarray['wall'] = 0; $datarray['network'] = NETWORK_DIASPORA; $datarray['guid'] = $guid; -- 2.39.5