mirror of
https://github.com/Akif9748/akf-forum.git
synced 2024-11-25 21:10:40 +03:00
16 lines
No EOL
454 B
JavaScript
16 lines
No EOL
454 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?.admin)) return res.error( 404,
|
|
`We don't have any message with id ${req.params.id}.`);
|
|
res.redirect(`/threads/${message.threadID}#message-${message.id}`);
|
|
|
|
});
|
|
|
|
module.exports = app; |