2 todo did.

This commit is contained in:
Akif9748 2022-08-09 19:48:10 +03:00
parent af649c0335
commit 086f2b5713
3 changed files with 4 additions and 7 deletions

View file

@ -22,9 +22,7 @@ And, you can learn about API in `util/APIDOCS.md`.
- `/errors/error` will change, better error page. - `/errors/error` will change, better error page.
- Redirect query. - Redirect query.
- middleware for timeouts - middleware for timeouts
- DELETED USERS: USERLIST
- Will fix API - Will fix API
- if admin you van see deleted messages.
## Roadmap ## Roadmap
### User ### User

View file

@ -33,7 +33,7 @@ app.get("/:id", async (req, res) => {
const messages = await Promise.all(thread.messages.map(async id => { const messages = await Promise.all(thread.messages.map(async id => {
const message = await MessageModel.get(id) const message = await MessageModel.get(id)
return (message.deleted || !message) ? null : message; return (user.admin || !message?.deleted) ? message : null;
})); }));
res.render("thread", { thread, messages, user }) res.render("thread", { thread, messages, user })

View file

@ -4,9 +4,8 @@ const app = Router();
const error = require("../errors/error"); const error = require("../errors/error");
const { UserModel, MessageModel, ThreadModel } = require("../models"); const { UserModel, MessageModel, ThreadModel } = require("../models");
app.get("/", async (req, res) => { app.get("/", async ({ user }, res) => {
const user = req.user const users = await UserModel.find(user.admin ? {} : { deleted: false });
const users = await UserModel.find({ deleted: false });
return res.render("users", { users, user }) return res.render("users", { users, user })
}); });