Reworked "getIdForURL"

This commit is contained in:
Michael 2020-08-07 13:49:59 +00:00
parent c89b690156
commit 7b13b7e9c8
8 changed files with 84 additions and 195 deletions

View file

@ -226,9 +226,9 @@ class Processor
$item['network'] = Protocol::ACTIVITYPUB;
$item['author-link'] = $activity['author'];
$item['author-id'] = Contact::getIdForURL($activity['author'], 0, false);
$item['author-id'] = Contact::getIdForURL($activity['author']);
$item['owner-link'] = $activity['actor'];
$item['owner-id'] = Contact::getIdForURL($activity['actor'], 0, false);
$item['owner-id'] = Contact::getIdForURL($activity['actor']);
if (in_array(0, $activity['receiver']) && !empty($activity['unlisted'])) {
$item['private'] = Item::UNLISTED;
@ -528,13 +528,13 @@ class Processor
$item['uid'] = $receiver;
if ($item['isForum'] ?? false) {
$item['contact-id'] = Contact::getIdForURL($activity['actor'], $receiver, false);
$item['contact-id'] = Contact::getIdForURL($activity['actor'], $receiver);
} else {
$item['contact-id'] = Contact::getIdForURL($activity['author'], $receiver, false);
$item['contact-id'] = Contact::getIdForURL($activity['author'], $receiver);
}
if (($receiver != 0) && empty($item['contact-id'])) {
$item['contact-id'] = Contact::getIdForURL($activity['author'], 0, false);
$item['contact-id'] = Contact::getIdForURL($activity['author']);
}
if (!empty($activity['directmessage'])) {

View file

@ -150,7 +150,7 @@ class Transmitter
*/
public static function getOutbox($owner, $page = null)
{
$public_contact = Contact::getIdForURL($owner['url'], 0, false);
$public_contact = Contact::getIdForURL($owner['url']);
$condition = ['uid' => 0, 'contact-id' => $public_contact, 'author-id' => $public_contact,
'private' => [Item::PUBLIC, Item::UNLISTED], 'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT],

View file

@ -690,7 +690,7 @@ class Feed
}
$check_date = empty($last_update) ? '' : DateTimeFormat::utc($last_update);
$authorid = Contact::getIdForURL($owner["url"], 0, false);
$authorid = Contact::getIdForURL($owner["url"]);
$condition = ["`uid` = ? AND `received` > ? AND NOT `deleted` AND `gravity` IN (?, ?)
AND `private` != ? AND `visible` AND `wall` AND `parent-network` IN (?, ?, ?, ?)",

View file

@ -219,7 +219,7 @@ class OStatus
}
// Ensure that we are having this contact (with uid=0)
$cid = Contact::getIdForURL($aliaslink, 0, false);
$cid = Contact::getIdForURL($aliaslink);
if ($cid) {
$fields = ['url', 'nurl', 'name', 'nick', 'alias', 'about', 'location'];
@ -2122,7 +2122,7 @@ class OStatus
}
$check_date = DateTimeFormat::utc($last_update);
$authorid = Contact::getIdForURL($owner["url"], 0, false);
$authorid = Contact::getIdForURL($owner["url"]);
$condition = ["`uid` = ? AND `received` > ? AND NOT `deleted`
AND `private` != ? AND `visible` AND `wall` AND `parent-network` IN (?, ?)",