diff options
Diffstat (limited to 'Digitigrade')
| -rw-r--r-- | Digitigrade/Model/Actor.php | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/Digitigrade/Model/Actor.php b/Digitigrade/Model/Actor.php index 3ad0efe..46c6f9a 100644 --- a/Digitigrade/Model/Actor.php +++ b/Digitigrade/Model/Actor.php @@ -41,7 +41,7 @@ class Actor extends PushableModel implements RpcReceiver { throw new \RuntimeException('an actor with that local handle already exists!'); } $actor = new self(); - $actor->uri = path_to_uri("/actor/$handle"); + $actor->uri = "UNKNOWN"; // need to know the id first $actor->isLocal = true; $date = new \DateTimeImmutable(); $actor->created = $date; @@ -56,8 +56,12 @@ class Actor extends PushableModel implements RpcReceiver { // don't actually need to set these either // just need to set the basicFeed since it's a required field $actor->endpoints = new ActorEndpoints(); - $actor->endpoints->basicFeed = path_to_uri("/actor/$handle/basicFeed"); + $actor->endpoints->basicFeed = "UNKNOWN"; + + $actor->save(); + $actor->uri = path_to_uri("/actor/$actor->id"); $actor->save(); + return $actor; } @@ -212,13 +216,13 @@ class Actor extends PushableModel implements RpcReceiver { if ($this->deleted) { return [ 'type' => 'tombstone', - 'self' => path_to_uri("/actor/$this->handle"), + 'self' => path_to_uri("/actor/$this->id"), 'previousType' => 'actor' ]; } return [ 'type' => 'actor', - 'self' => path_to_uri("/actor/$this->handle"), + 'self' => path_to_uri("/actor/$this->id"), 'created' => $this->created?->format('c'), 'modified' => $this->modified?->format('c'), 'homepage' => path_to_uri("/@/$this->handle"), @@ -230,12 +234,12 @@ class Actor extends PushableModel implements RpcReceiver { 'automated' => $this->automated, 'requestToFollow' => $this->requestToFollow, 'endpoints' => [ - 'basicFeed' => path_to_uri("/actor/$this->handle/basicFeed"), - 'fullFeed' => path_to_uri("/actor/$this->handle/fullFeed"), - 'follow' => path_to_uri("/actor/$this->handle/follow"), - 'unfollow' => path_to_uri("/actor/$this->handle/unfollow"), - 'acceptedFollow' => path_to_uri("/actor/$this->handle/acceptedFollow"), - 'rejectedFollow' => path_to_uri("/actor/$this->handle/rejectedFollow"), + 'basicFeed' => path_to_uri("/actor/$this->id/basicFeed"), + 'fullFeed' => path_to_uri("/actor/$this->id/fullFeed"), + 'follow' => path_to_uri("/actor/$this->id/follow"), + 'unfollow' => path_to_uri("/actor/$this->id/unfollow"), + 'acceptedFollow' => path_to_uri("/actor/$this->id/acceptedFollow"), + 'rejectedFollow' => path_to_uri("/actor/$this->id/rejectedFollow"), ] ]; } |
