Merge pull request #4942 from MrPetovan/task/import-post-ignored-contact

Import posts from ignored contacts
This commit is contained in:
Michael Vogel 2018-04-28 18:16:30 +02:00 committed by GitHub
commit 833fe0e0dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 11 deletions

View file

@ -470,11 +470,14 @@ These Fields are not added below (yet). They are here to for bug search.
* @brief SQL join for contacts that are needed for displaying items * @brief SQL join for contacts that are needed for displaying items
*/ */
function item_joins() { function item_joins() {
return "STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND return sprintf("STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
(NOT `contact`.`blocked` OR `contact`.`pending`) AND (`contact`.`rel` IN (%s, %s) OR `contact`.`self`)
AND NOT (`contact`.`blocked` OR `contact`.`readonly` OR `contact`.`pending`)
LEFT JOIN `contact` AS `author` ON `author`.`id`=`item`.`author-id` LEFT JOIN `contact` AS `author` ON `author`.`id`=`item`.`author-id`
LEFT JOIN `contact` AS `owner` ON `owner`.`id`=`item`.`owner-id` LEFT JOIN `contact` AS `owner` ON `owner`.`id`=`item`.`owner-id`
LEFT JOIN `event` ON `event-id` = `event`.`id`"; LEFT JOIN `event` ON `event-id` = `event`.`id`",
CONTACT_IS_SHARING, CONTACT_IS_FRIEND
);
} }
/** /**

View file

@ -872,7 +872,7 @@ class Item extends BaseObject
$users = []; $users = [];
$condition = ["`nurl` IN (SELECT `nurl` FROM `contact` WHERE `id` = ?) AND `uid` != 0 AND NOT `blocked` AND NOT `readonly` AND `rel` IN (?, ?)", $condition = ["`nurl` IN (SELECT `nurl` FROM `contact` WHERE `id` = ?) AND `uid` != 0 AND NOT `blocked` AND `rel` IN (?, ?)",
$parent['owner-id'], CONTACT_IS_SHARING, CONTACT_IS_FRIEND]; $parent['owner-id'], CONTACT_IS_SHARING, CONTACT_IS_FRIEND];
$contacts = dba::select('contact', ['uid'], $condition); $contacts = dba::select('contact', ['uid'], $condition);
while ($contact = dba::fetch($contacts)) { while ($contact = dba::fetch($contacts)) {

View file

@ -2799,10 +2799,6 @@ class DFRN
return true; return true;
} }
} else { // $entrytype == DFRN_TOP_LEVEL } else { // $entrytype == DFRN_TOP_LEVEL
if ($importer["readonly"]) {
logger('ignoring read-only contact '.$importer["id"]);
return;
}
if (($importer["uid"] == 0) && ($importer["importer_uid"] != 0)) { if (($importer["uid"] == 0) && ($importer["importer_uid"] != 0)) {
logger("Contact ".$importer["id"]." isn't known to user ".$importer["importer_uid"].". The post will be ignored.", LOGGER_DEBUG); logger("Contact ".$importer["id"]." isn't known to user ".$importer["importer_uid"].". The post will be ignored.", LOGGER_DEBUG);
return; return;

View file

@ -1151,7 +1151,7 @@ class Diaspora
//} //}
// We don't seem to like that person // We don't seem to like that person
if ($contact["blocked"] || $contact["readonly"]) { if ($contact["blocked"]) {
// Maybe blocked, don't accept. // Maybe blocked, don't accept.
return false; return false;
// We are following this person? // We are following this person?

View file

@ -309,7 +309,7 @@ class OnePoll
// Are we allowed to import from this person? // Are we allowed to import from this person?
if ($contact['rel'] == CONTACT_IS_FOLLOWER || $contact['blocked'] || $contact['readonly']) { if ($contact['rel'] == CONTACT_IS_FOLLOWER || $contact['blocked']) {
// set the last-update so we don't keep polling // set the last-update so we don't keep polling
dba::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]); dba::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
return; return;
@ -590,7 +590,7 @@ class OnePoll
} }
$hubmode = 'subscribe'; $hubmode = 'subscribe';
if ($contact['network'] === NETWORK_DFRN || $contact['blocked'] || $contact['readonly']) { if ($contact['network'] === NETWORK_DFRN || $contact['blocked']) {
$hubmode = 'unsubscribe'; $hubmode = 'unsubscribe';
} }