Fix relay handling
This commit is contained in:
parent
b8243689a0
commit
4cfcaa82c0
2 changed files with 6 additions and 8 deletions
|
@ -91,8 +91,8 @@ HELP;
|
||||||
|
|
||||||
if ((count($this->args) == 1) && ($this->getArgument(0) == 'list')) {
|
if ((count($this->args) == 1) && ($this->getArgument(0) == 'list')) {
|
||||||
$contacts = $this->dba->select('apcontact', ['url'],
|
$contacts = $this->dba->select('apcontact', ['url'],
|
||||||
["`type` = ? AND `url` IN (SELECT `url` FROM `contact` WHERE `uid` = ? AND `rel` IN (?, ?))",
|
["`type` = ? AND `url` IN (SELECT `url` FROM `contact` WHERE `uid` = ? AND `rel` = ?)",
|
||||||
'Application', 0, Contact::FOLLOWER, Contact::FRIEND]);
|
'Application', 0, Contact::FRIEND]);
|
||||||
while ($contact = $this->dba->fetch($contacts)) {
|
while ($contact = $this->dba->fetch($contacts)) {
|
||||||
$this->out($contact['url']);
|
$this->out($contact['url']);
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,8 +68,8 @@ class Transmitter
|
||||||
public static function addRelayServerInboxes(array $inboxes = [])
|
public static function addRelayServerInboxes(array $inboxes = [])
|
||||||
{
|
{
|
||||||
$contacts = DBA::select('apcontact', ['inbox'],
|
$contacts = DBA::select('apcontact', ['inbox'],
|
||||||
["`type` = ? AND `url` IN (SELECT `url` FROM `contact` WHERE `uid` = ? AND `rel` IN (?, ?))",
|
["`type` = ? AND `url` IN (SELECT `url` FROM `contact` WHERE `uid` = ? AND `rel` = ?)",
|
||||||
'Application', 0, Contact::FOLLOWER, Contact::FRIEND]);
|
'Application', 0, Contact::FRIEND]);
|
||||||
while ($contact = DBA::fetch($contacts)) {
|
while ($contact = DBA::fetch($contacts)) {
|
||||||
$inboxes[$contact['inbox']] = $contact['inbox'];
|
$inboxes[$contact['inbox']] = $contact['inbox'];
|
||||||
}
|
}
|
||||||
|
@ -119,8 +119,7 @@ class Transmitter
|
||||||
$activity_id = ActivityPub\Transmitter::activityIDFromContact($contact['id']);
|
$activity_id = ActivityPub\Transmitter::activityIDFromContact($contact['id']);
|
||||||
$success = ActivityPub\Transmitter::sendActivity('Follow', $url, 0, $activity_id);
|
$success = ActivityPub\Transmitter::sendActivity('Follow', $url, 0, $activity_id);
|
||||||
if ($success) {
|
if ($success) {
|
||||||
$rel = $contact['rel'] == Contact::SHARING ? Contact::FRIEND : Contact::FOLLOWER;
|
DBA::update('contact', ['rel' => Contact::FRIEND], ['id' => $contact['id']]);
|
||||||
DBA::update('contact', ['rel' => $rel], ['id' => $contact['id']]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $success;
|
return $success;
|
||||||
|
@ -142,8 +141,7 @@ class Transmitter
|
||||||
|
|
||||||
$success = self::sendContactUndo($url, $contact['id'], 0);
|
$success = self::sendContactUndo($url, $contact['id'], 0);
|
||||||
if ($success || $force) {
|
if ($success || $force) {
|
||||||
$rel = $contact['rel'] == Contact::FRIEND ? Contact::SHARING : Contact::NOTHING;
|
DBA::update('contact', ['rel' => Contact::NOTHING], ['id' => $contact['id']]);
|
||||||
DBA::update('contact', ['rel' => $rel], ['id' => $contact['id']]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $success;
|
return $success;
|
||||||
|
|
Loading…
Reference in a new issue