diff options
| author | winter | 2024-12-24 14:15:02 +0000 |
|---|---|---|
| committer | winter | 2024-12-24 14:15:02 +0000 |
| commit | 503a49b7d7b4275fd09b4a7c06cbdbdf257fef79 (patch) | |
| tree | 4611c864e1450a6e56a25f5ddda196ec41373e78 /Digitigrade | |
| parent | ef16890f38bd4256da1b873a89dfadc5067d63a9 (diff) | |
breaking change: use id in actor uri instead of handle
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"), ] ]; } |
