aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates/thread_page.php
blob: da7c556daadad911992c834ad2efa1dfaf6fc87d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
use Digitigrade\Model\Note;
use Digitigrade\Model\UserAccount;

call_template('skeleton', [
    'pageTitle' => '"' . $note->plainContent . '" - @' . $note->author->getFullHandle(),
    'renderTitleHeading' => false,
    'ogTitle' => $note->author->displayName,
    'ogDesc' => $note->plainContent,
    'ogImage' => $note->author->avatar ?? path_to_uri('/static/default-avatar.png'),
    'ogType' => 'article',
    'ogHandle' => '@' . $note->author->getFullHandle(true)
], function () {
    global $note;
    $targetNote = $note; // renaming this because my templating system clobbers it. :(
    $notes = Note::findAllInThread($targetNote->threadApex ?? $targetNote);
    $user = UserAccount::findByCurrentSession();
    foreach ($notes as $n) {
        /** @var Note $n */
        if (!($user != null && $user->actor->blocks($n->author)) && $n->isViewableBy($user) && !$n->deleted) {
            call_template('note/note', ['note' => $n, 'selected' => $n == $targetNote]);
        }
    }
});