aboutsummaryrefslogtreecommitdiffhomepage
path: root/routes/note.php
diff options
context:
space:
mode:
authorwinter2025-03-15 22:36:13 +0000
committerwinter2025-03-15 22:36:13 +0000
commita0a86c3a98a6af158ecd2f1923feb752c82907db (patch)
tree4584310a53001c384870d53b6cfd0357956498ee /routes/note.php
parent69951643b98aea431048e1405982d56c406bb412 (diff)
don't list pages the user can't view
Diffstat (limited to 'routes/note.php')
-rw-r--r--routes/note.php7
1 files changed, 2 insertions, 5 deletions
diff --git a/routes/note.php b/routes/note.php
index 6dd0025..1967a2d 100644
--- a/routes/note.php
+++ b/routes/note.php
@@ -40,11 +40,8 @@ Router::getInstance()->mount('/@/:handle/note/:id', function (array $args) {
throw new NotFound("i don't know that note");
}
// check the current user is allowed to see it
- if ($note->privacy->scope != NotePrivacyScope::PUBLIC ) {
- $user = UserAccount::requireByCurrentSession();
- if (!in_array($user->actor, $note->getRelevantActors())) {
- throw new Forbidden();
- }
+ if (!$note->isViewableBy(UserAccount::findByCurrentSession())) {
+ throw new Forbidden();
}
// change the handle in the url if it's wrong
if ($args['handle'] != $note->author->getFullHandle()) {