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 +++++----- views/header.pug | 4 ++-- views/message_inbox.pug | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) 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") }) /* diff --git a/views/header.pug b/views/header.pug index d386969..9ff1263 100644 --- a/views/header.pug +++ b/views/header.pug @@ -16,9 +16,9 @@ header a(href="/games/active") Games a(href="/contacts") Friends if user.unread > 0 - a(href="/inbox") Inbox (#{user.unread}) + a(href="/message/inbox") Inbox (#{user.unread}) else - a(href="/inbox") Inbox + a(href="/message/inbox") Inbox a(href="/profile") Profile (#{user.name}) else a(href="/signup") Signup diff --git a/views/message_inbox.pug b/views/message_inbox.pug index c6001f5..4f02790 100644 --- a/views/message_inbox.pug +++ b/views/message_inbox.pug @@ -38,4 +38,4 @@ html td(colspan=3) No messages. p - a(href="/outbox") Outbox + a(href="/message/outbox") Outbox -- cgit v1.2.3