Major bug fix

This commit is contained in:
Akif9748 2022-09-09 16:30:57 +03:00
parent 74b6b73b72
commit bfac0b16af

View file

@ -22,9 +22,9 @@ app.get("/:id/", async (req, res) => {
const page = Number(req.query.page || 0); const page = Number(req.query.page || 0);
const thread = await ThreadModel.get(id) const thread = await ThreadModel.get(id)
if (thread && (user?.admin || !thread.deleted)) {
thread.count = await thread.messageCount(user?.admin); thread.count = await thread.messageCount(user?.admin);
thread.pages = Math.ceil(thread.count / 10); thread.pages = Math.ceil(thread.count / 10);
if (thread && (user?.admin || !thread.deleted)) {
thread.views++; thread.views++;
const query = { threadID: id }; const query = { threadID: id };
if (!user || !user.admin) query.deleted = false; if (!user || !user.admin) query.deleted = false;