From fea439b57f9ba225e2d3169d7615c0bd2aecabe4 Mon Sep 17 00:00:00 2001 From: winter Date: Wed, 1 Jan 2025 19:52:18 +0000 Subject: ultra basic post form doesn't do much but i just wanted to get this working at a bare minimum --- routes/note_fragment.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'routes/note_fragment.php') diff --git a/routes/note_fragment.php b/routes/note_fragment.php index ef2e7b0..3cb1fcc 100644 --- a/routes/note_fragment.php +++ b/routes/note_fragment.php @@ -1,10 +1,22 @@ 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'); }); \ No newline at end of file -- cgit v1.3