mirror of
https://github.com/Akif9748/akf-forum.git
synced 2024-12-23 08:09:08 +03:00
15 lines
No EOL
432 B
JavaScript
15 lines
No EOL
432 B
JavaScript
const { MessageModel } = require("../models");
|
|
|
|
const { Router } = require("express");
|
|
|
|
const app = Router();
|
|
|
|
app.get("/:id", async (req, res) => {
|
|
const message = await MessageModel.get(req.params.id);
|
|
|
|
if (!message || (message.deleted && req.user && !req.user.admin)) return res.error( 404, "We have not got any message declared as this id.");
|
|
res.redirect("/threads/" + message.threadID);
|
|
|
|
});
|
|
|
|
module.exports = app; |