summaryrefslogtreecommitdiff
path: root/server.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-10-08 20:55:18 +0200
committerTor Andersson <tor@ccxvii.net>2024-10-10 00:06:19 +0200
commit8cb4bd5107886da9198bbd4834551e4a53b54736 (patch)
tree1f05eb7591e8eb983c3128565b68e463e150a922 /server.js
parent02002281e6752b311b8c0d194af03b178d2f6f3d (diff)
downloadserver-8cb4bd5107886da9198bbd4834551e4a53b54736.tar.gz
Put inbox and outbox under /message URL namespace.
Diffstat (limited to 'server.js')
-rw-r--r--server.js10
1 files changed, 5 insertions, 5 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")
})
/*