diff options
| author | winter | 2025-01-16 20:21:42 +0000 |
|---|---|---|
| committer | winter | 2025-01-16 20:21:42 +0000 |
| commit | b1d6fbc4d740324d96d7fe2677fb15b9b59d20ea (patch) | |
| tree | ae2c996cc6a42b3a42437a7ec8812cd184644817 /Digitigrade | |
| parent | 8de5608976dc8a73a400267601acb4c8e127de5a (diff) | |
follow requests
Diffstat (limited to 'Digitigrade')
| -rw-r--r-- | Digitigrade/Model/Actor.php | 12 | ||||
| -rw-r--r-- | Digitigrade/Model/Session.php | 10 |
2 files changed, 22 insertions, 0 deletions
diff --git a/Digitigrade/Model/Actor.php b/Digitigrade/Model/Actor.php index 8a37b1c..d04c841 100644 --- a/Digitigrade/Model/Actor.php +++ b/Digitigrade/Model/Actor.php @@ -206,6 +206,18 @@ class Actor extends PushableModel implements RpcReceiver { } /** + * @return Actor[] a list of actors that would like to follow this actor + */ + public function findPendingFollowers(): array { + $relations = FollowRelation::findAllWithObject($this); + $relations = array_filter( + $relations, + fn(FollowRelation $rel) => $rel->status == FollowRelationStatus::PENDING + ); + return array_map(fn(FollowRelation $rel) => $rel->subject, $relations); + } + + /** * @return Actor[] a list of actors that both follow and are followed by this actor */ public function findMutualFollows(): array { diff --git a/Digitigrade/Model/Session.php b/Digitigrade/Model/Session.php index 31fb8bb..07827c0 100644 --- a/Digitigrade/Model/Session.php +++ b/Digitigrade/Model/Session.php @@ -40,4 +40,14 @@ class Session extends Model { 'secure' => GlobalConfig::getInstance()->isHttps() ]); } + + public function clearCookie() { + setcookie('digitigrade-session', '', [ + 'expires' => (new \DateTimeImmutable('1 year ago'))->getTimestamp(), + 'httponly' => true, + 'samesite' => 'Lax', + 'path' => '/', + 'secure' => GlobalConfig::getInstance()->isHttps() + ]); + } }
\ No newline at end of file |
