Refactor Model\Contact::addRelationship

- Remove unused parameter $item
- Replace q() call with DBA::insert
- Update check on $contact that can only be an array now
- Add moethod doc block
This commit is contained in:
Hypolite Petovan 2019-05-19 18:43:19 -04:00
parent 956ae6241d
commit 3114754f4b
4 changed files with 33 additions and 30 deletions

View file

@ -530,7 +530,7 @@ class Processor
DBA::update('contact', ['hub-verify' => $activity['id'], 'protocol' => Protocol::ACTIVITYPUB], ['id' => $cid]);
$contact = DBA::selectFirst('contact', [], ['id' => $cid, 'network' => Protocol::NATIVE_SUPPORT]);
} else {
$contact = false;
$contact = [];
}
$item = ['author-id' => Contact::getIdForURL($activity['actor']),
@ -541,7 +541,7 @@ class Processor
// Ensure that the contact has got the right network type
self::switchContact($item['author-id']);
Contact::addRelationship($owner, $contact, $item, '', false, $note);
$result = Contact::addRelationship($owner, $contact, $item, false, $note);
$cid = Contact::getIdForURL($activity['actor'], $uid);
if (empty($cid)) {
return;