aboutsummaryrefslogtreecommitdiffhomepage
path: root/routes
diff options
context:
space:
mode:
Diffstat (limited to 'routes')
-rw-r--r--routes/note_fragment.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/routes/note_fragment.php b/routes/note_fragment.php
index 9170e2b..83e7655 100644
--- a/routes/note_fragment.php
+++ b/routes/note_fragment.php
@@ -32,6 +32,20 @@ Router::getInstance()->mount('/fragment/note/:id/:action', function (array $args
render_template('interaction_button', ['action' => $args['action'], 'active' => $active, 'note' => $note]);
});
+Router::getInstance()->mount('/fragment/note/:id/reply', function (array $args) {
+ // replying to a note
+ $author = UserAccount::requireByCurrentSession();
+ $note = Note::find($args['id']);
+ if (isset($_POST['content'])) {
+ $reply = Note::create($author->actor, $_POST['content'], 'unk');
+ $reply->inReplyTo = $note;
+ $reply->threadApex = $note->threadApex ?? $note;
+ $reply->save();
+ $reply->publish();
+ }
+ render_template('reply_form');
+});
+
Router::getInstance()->mount('/fragment/note', function (array $args) {
// posting a new note
$author = UserAccount::requireByCurrentSession();