Fix Notice typo and follow request system
This commit is contained in:
parent
f77bad0159
commit
d90fabd15e
@ -77,7 +77,7 @@ class Activitypub_notice extends Managed_DataObject
|
|||||||
'type' => 'Note',
|
'type' => 'Note',
|
||||||
'published' => str_replace(' ', 'T', $notice->getCreated()).'Z',
|
'published' => str_replace(' ', 'T', $notice->getCreated()).'Z',
|
||||||
'url' => $notice->getUrl(),
|
'url' => $notice->getUrl(),
|
||||||
'atributedTo' => ActivityPubPlugin::actor_uri($profile),
|
'atributtedTo' => ActivityPubPlugin::actor_uri($profile),
|
||||||
'to' => $to,
|
'to' => $to,
|
||||||
'cc' => common_local_url('apActorFollowers', ['id' => $profile->getID()]),
|
'cc' => common_local_url('apActorFollowers', ['id' => $profile->getID()]),
|
||||||
'atomUri' => $notice->getUrl(),
|
'atomUri' => $notice->getUrl(),
|
||||||
|
@ -118,18 +118,14 @@ class Activitypub_postman
|
|||||||
|
|
||||||
if ($res->getStatusCode() == 200 || $res->getStatusCode() == 409) {
|
if ($res->getStatusCode() == 200 || $res->getStatusCode() == 409) {
|
||||||
$pending_list = new Activitypub_pending_follow_requests($this->actor->getID(), $this->to[0]->getID());
|
$pending_list = new Activitypub_pending_follow_requests($this->actor->getID(), $this->to[0]->getID());
|
||||||
if (! ($res->getStatusCode() == 409 || $res_body->type == "Accept")) {
|
|
||||||
$pending_list->add();
|
$pending_list->add();
|
||||||
throw new Exception("Your follow request is pending acceptation.");
|
|
||||||
}
|
|
||||||
$pending_list->remove();
|
|
||||||
return true;
|
return true;
|
||||||
} elseif (isset($res_body[0]->error)) {
|
} elseif (isset($res_body[0]->error)) {
|
||||||
throw new Exception($res_body[0]->error);
|
throw new Exception($res_body[0]->error);
|
||||||
}
|
} else {
|
||||||
|
|
||||||
throw new Exception("An unknown error occurred.");
|
throw new Exception("An unknown error occurred.");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a Undo Follow notification to remote instance
|
* Send a Undo Follow notification to remote instance
|
||||||
|
Reference in New Issue
Block a user