From 8cb4bd5107886da9198bbd4834551e4a53b54736 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 8 Oct 2024 20:55:18 +0200 Subject: Put inbox and outbox under /message URL namespace. --- server.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'server.js') diff --git a/server.js b/server.js index 6233f93..0afdac9 100644 --- a/server.js +++ b/server.js @@ -828,7 +828,7 @@ const MESSAGE_DELETE_INBOX = SQL("UPDATE messages SET is_deleted_from_inbox=1 WH const MESSAGE_DELETE_OUTBOX = SQL("UPDATE messages SET is_deleted_from_outbox=1 WHERE message_id=? AND from_id=?") const MESSAGE_DELETE_ALL_OUTBOX = SQL("UPDATE messages SET is_deleted_from_outbox=1 WHERE from_id=?") -app.get("/inbox", must_be_logged_in, function (req, res) { +app.get("/message/inbox", must_be_logged_in, function (req, res) { let messages = MESSAGE_LIST_INBOX.all(req.user.user_id) for (let i = 0; i < messages.length; ++i) messages[i].time = human_date(messages[i].time) @@ -838,7 +838,7 @@ app.get("/inbox", must_be_logged_in, function (req, res) { }) }) -app.get("/outbox", must_be_logged_in, function (req, res) { +app.get("/message/outbox", must_be_logged_in, function (req, res) { let messages = MESSAGE_LIST_OUTBOX.all(req.user.user_id) for (let i = 0; i < messages.length; ++i) messages[i].time = human_date(messages[i].time) @@ -907,7 +907,7 @@ app.post("/message/send", must_be_logged_in, function (req, res) { } let info = MESSAGE_SEND.run(req.user.user_id, to_user.user_id, subject, body) send_notification(to_user, message_link(info.lastInsertRowid), "New message from " + req.user.name) - res.redirect("/inbox") + res.redirect("/message/inbox") }) function quote_body(message) { @@ -935,14 +935,14 @@ app.get("/message/reply/:message_id", must_be_logged_in, function (req, res) { app.get("/message/delete/outbox", must_be_logged_in, function (req, res) { MESSAGE_DELETE_ALL_OUTBOX.run(req.user.user_id) - res.redirect("/outbox") + res.redirect("/message/outbox") }) app.get("/message/delete/:message_id", must_be_logged_in, function (req, res) { let message_id = req.params.message_id | 0 MESSAGE_DELETE_INBOX.run(message_id, req.user.user_id) MESSAGE_DELETE_OUTBOX.run(message_id, req.user.user_id) - res.redirect("/inbox") + res.redirect("/message/inbox") }) /* -- cgit v1.2.3