aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates/thread_page.php
blob: cec94e2e2eb8a7af988e423a95b9231a7f5a926c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?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) {
        if (!($user != null && $user->actor->blocks($n->author))) {
            call_template('note', ['note' => $n, 'selected' => $n == $targetNote]);
        }
    }
});