Don't poll locally / user self data

This commit is contained in:
Michael 2020-08-19 05:18:19 +00:00
parent eb95314aaa
commit 3d1829ede5
2 changed files with 17 additions and 0 deletions

View File

@ -1576,12 +1576,20 @@ class Contact
return;
}
$local_uid = User::getIdForURL($contact['url']);
if (!empty($local_uid)) {
$fields = self::selectFirst(['avatar', 'avatar-date', 'photo', 'thumb', 'micro'], ['self' => true, 'uid' => $local_uid]);
}
// Replace cached avatar pictures from the default avatar with the default avatars in different sizes
if (strpos($avatar, self::DEFAULT_AVATAR_PHOTO)) {
$fields = ['avatar' => $avatar, 'avatar-date' => DateTimeFormat::utcNow(),
'photo' => DI::baseUrl() . self::DEFAULT_AVATAR_PHOTO,
'thumb' => DI::baseUrl() . self::DEFAULT_AVATAR_THUMB,
'micro' => DI::baseUrl() . self::DEFAULT_AVATAR_MICRO];
}
if (!empty($fields)) {
if ($fields['photo'] . $fields['thumb'] . $fields['micro'] != $contact['photo'] . $contact['thumb'] . $contact['micro']) {
DBA::update('contact', $fields, ['id' => $cid]);
Photo::delete(['uid' => $uid, 'contact-id' => $cid, 'album' => Photo::CONTACT_PHOTOS]);

View File

@ -103,6 +103,15 @@ class OnePoll
return;
}
// Don't poll local contacts
if (Contact::isLocalById($contact['id'])) {
Logger::info('Local contacts are not polled', ['id' => $contact['id']]);
// set the last-update so we don't keep polling
DBA::update('contact', ['last-update' => $updated], ['id' => $contact['id']]);
return;
}
// We don't poll AP contacts by now
if ($protocol === Protocol::ACTIVITYPUB) {
Logger::log("Don't poll AP contact");