aboutsummaryrefslogtreecommitdiffhomepage
path: root/routes/note_fragment.php
diff options
context:
space:
mode:
authorwinter2025-01-01 19:52:18 +0000
committerwinter2025-01-01 19:52:18 +0000
commitfea439b57f9ba225e2d3169d7615c0bd2aecabe4 (patch)
tree477357cb50c029fde839aea272ba30b20a66129f /routes/note_fragment.php
parent02a6acd4cfddaecd9075b706fdbdc0396d76d8c3 (diff)
ultra basic post form
doesn't do much but i just wanted to get this working at a bare minimum
Diffstat (limited to 'routes/note_fragment.php')
-rw-r--r--routes/note_fragment.php12
1 files changed, 12 insertions, 0 deletions
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 @@
<?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');
}); \ No newline at end of file