blob: 3cb1fcc721c457f941712ededb015d9795e5d661 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
<?php
use Digitigrade\Model\Note;
use Digitigrade\Model\UserAccount;
use Digitigrade\Router;
Router::getInstance()->mount('/fragment/note/:id/:action', function (array $args) {
$note = Note::find($args['id']);
// TODO: actually like/dislike/reshare the note as the currently signed in user
render_template('interaction_button', ['action' => $args['action'], 'active' => true, 'note' => $note]);
});
Router::getInstance()->mount('/fragment/note', function (array $args) {
// posting a new note
$author = UserAccount::requireByCurrentSession();
if (isset($_POST['content'])) {
// TODO: summary field, post language, privacy, etc
$note = Note::create($author->actor, $_POST['content'], 'unk');
$note->publish();
}
render_template('write_note_form');
});
|