Simplify Contact::addRelationship call in ActivityPub\Processor::followUser
- Address https://github.com/friendica/friendica/issues/9250#issuecomment-743382769
This commit is contained in:
parent
c787281eff
commit
8f10cf8e53
|
@ -903,20 +903,15 @@ class Processor
|
||||||
if (!empty($cid)) {
|
if (!empty($cid)) {
|
||||||
self::switchContact($cid);
|
self::switchContact($cid);
|
||||||
DBA::update('contact', ['hub-verify' => $activity['id'], 'protocol' => Protocol::ACTIVITYPUB], ['id' => $cid]);
|
DBA::update('contact', ['hub-verify' => $activity['id'], 'protocol' => Protocol::ACTIVITYPUB], ['id' => $cid]);
|
||||||
$contact = DBA::selectFirst('contact', [], ['id' => $cid, 'network' => Protocol::NATIVE_SUPPORT]);
|
|
||||||
} else {
|
|
||||||
$contact = [];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$item = ['author-id' => Contact::getIdForURL($activity['actor']),
|
$item = ['author-id' => Contact::getIdForURL($activity['actor']),
|
||||||
'author-link' => $activity['actor']];
|
'author-link' => $activity['actor']];
|
||||||
|
|
||||||
$note = Strings::escapeTags(trim($activity['content'] ?? ''));
|
|
||||||
|
|
||||||
// Ensure that the contact has got the right network type
|
// Ensure that the contact has got the right network type
|
||||||
self::switchContact($item['author-id']);
|
self::switchContact($item['author-id']);
|
||||||
|
|
||||||
$result = Contact::addRelationship($owner, $contact, $item, false, $note);
|
$result = Contact::addRelationship($owner, [], $item, false, $activity['content'] ?? '');
|
||||||
if ($result === true) {
|
if ($result === true) {
|
||||||
ActivityPub\Transmitter::sendContactAccept($item['author-link'], $activity['id'], $owner['uid']);
|
ActivityPub\Transmitter::sendContactAccept($item['author-link'], $activity['id'], $owner['uid']);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user