Merge pull request #9543 from MrPetovan/bug/notices

Address several notices
This commit is contained in:
Michael Vogel 2020-11-18 00:30:31 +01:00 committed by GitHub
commit dc5624b0b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 5 additions and 14 deletions

View file

@ -1113,7 +1113,7 @@ class Contact
$contact = self::selectFirst(['id'], ['nurl' => $urls, 'uid' => $uid]); $contact = self::selectFirst(['id'], ['nurl' => $urls, 'uid' => $uid]);
if (!empty($contact['id'])) { if (!empty($contact['id'])) {
$contact_id = $contact['id']; $contact_id = $contact['id'];
Logger::info('Fetched id by url', ['cid' => $contact_id, 'uid' => $uid, 'url' => $url, 'probed_url' => $data['url'], 'alias' => $data['alias'], 'addr' => $data['addr']]); Logger::info('Fetched id by url', ['cid' => $contact_id, 'uid' => $uid, 'url' => $url, 'data' => $data]);
} }
} }

View file

@ -3980,12 +3980,12 @@ class Item
// The causer is set during a thread completion, for example because of a reshare. It countains the responsible actor. // The causer is set during a thread completion, for example because of a reshare. It countains the responsible actor.
if (!empty($item['causer-id']) && Contact\User::isBlocked($item['causer-id'], $user_id)) { if (!empty($item['causer-id']) && Contact\User::isBlocked($item['causer-id'], $user_id)) {
Logger::notice('Causer is blocked by user', ['causer-link' => $item['causer-link'], 'uid' => $user_id, 'item-uri' => $item['uri']]); Logger::notice('Causer is blocked by user', ['causer-link' => $item['causer-link'] ?? $item['causer-id'], 'uid' => $user_id, 'item-uri' => $item['uri']]);
return false; return false;
} }
if (!empty($item['causer-id']) && ($item['gravity'] === GRAVITY_PARENT) && Contact\User::isIgnored($item['causer-id'], $user_id)) { if (!empty($item['causer-id']) && ($item['gravity'] === GRAVITY_PARENT) && Contact\User::isIgnored($item['causer-id'], $user_id)) {
Logger::notice('Causer is ignored by user', ['causer-link' => $item['causer-link'], 'uid' => $user_id, 'item-uri' => $item['uri']]); Logger::notice('Causer is ignored by user', ['causer-link' => $item['causer-link'] ?? $item['causer-id'], 'uid' => $user_id, 'item-uri' => $item['uri']]);
return false; return false;
} }

View file

@ -719,7 +719,7 @@ class Transmitter
continue; continue;
} }
if ($isforum && ($contact['dfrn'] == Protocol::DFRN)) { if ($isforum && ($contact['network'] == Protocol::DFRN)) {
continue; continue;
} }

View file

@ -1565,7 +1565,6 @@ class Diaspora
$datarray["gravity"] = GRAVITY_COMMENT; $datarray["gravity"] = GRAVITY_COMMENT;
$datarray['thr-parent'] = $thr_parent ?: $toplevel_parent_item['uri']; $datarray['thr-parent'] = $thr_parent ?: $toplevel_parent_item['uri'];
$datarray['parent-uri'] = $toplevel_parent_item['uri'];
$datarray["object-type"] = Activity\ObjectType::COMMENT; $datarray["object-type"] = Activity\ObjectType::COMMENT;
@ -1963,7 +1962,6 @@ class Diaspora
$datarray["verb"] = Activity::FOLLOW; $datarray["verb"] = Activity::FOLLOW;
$datarray["gravity"] = GRAVITY_ACTIVITY; $datarray["gravity"] = GRAVITY_ACTIVITY;
$datarray['thr-parent'] = $toplevel_parent_item['uri']; $datarray['thr-parent'] = $toplevel_parent_item['uri'];
$datarray['parent-uri'] = $toplevel_parent_item['parent-uri'];
$datarray["object-type"] = Activity\ObjectType::NOTE; $datarray["object-type"] = Activity\ObjectType::NOTE;
@ -2356,7 +2354,6 @@ class Diaspora
$datarray['guid'] = $parent['guid'] . '-' . $guid; $datarray['guid'] = $parent['guid'] . '-' . $guid;
$datarray['uri'] = self::getUriFromGuid($author, $datarray['guid']); $datarray['uri'] = self::getUriFromGuid($author, $datarray['guid']);
$datarray['thr-parent'] = $parent['uri']; $datarray['thr-parent'] = $parent['uri'];
$datarray['parent-uri'] = $parent['parent-uri'];
$datarray['verb'] = $datarray['body'] = Activity::ANNOUNCE; $datarray['verb'] = $datarray['body'] = Activity::ANNOUNCE;
$datarray['gravity'] = GRAVITY_ACTIVITY; $datarray['gravity'] = GRAVITY_ACTIVITY;

View file

@ -521,12 +521,6 @@ class OStatus
Logger::log("Item with uri ".self::$itemlist[0]['uri']." will be imported since the thread contains posts or shares.", Logger::DEBUG); Logger::log("Item with uri ".self::$itemlist[0]['uri']." will be imported since the thread contains posts or shares.", Logger::DEBUG);
} }
} }
} else {
// But we will only import complete threads
$valid = Item::exists(['uid' => $importer["uid"], 'uri' => self::$itemlist[0]['parent-uri']]);
if ($valid) {
Logger::log("Item with uri ".self::$itemlist[0]["uri"]." belongs to parent ".self::$itemlist[0]['thr-parent']." of user ".$importer["uid"].". It will be imported.", Logger::DEBUG);
}
} }
if ($valid) { if ($valid) {

View file

@ -61,7 +61,7 @@ header('Cache-Control: public');
header('ETag: "'.$etag.'"'); header('ETag: "'.$etag.'"');
header('Last-Modified: '.$modified); header('Last-Modified: '.$modified);
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) || isset($_SERVER['HTTP_IF_NONE_MATCH'])) { if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
$cached_modified = gmdate('r', strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])); $cached_modified = gmdate('r', strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']));
$cached_etag = str_replace(['"', "-gzip"], ['', ''], $cached_etag = str_replace(['"', "-gzip"], ['', ''],
stripslashes($_SERVER['HTTP_IF_NONE_MATCH'])); stripslashes($_SERVER['HTTP_IF_NONE_MATCH']));