mirror of
https://github.com/Akif9748/akf-forum.git
synced 2024-11-22 20:10:40 +03:00
2 todo did.
This commit is contained in:
parent
af649c0335
commit
086f2b5713
3 changed files with 4 additions and 7 deletions
|
@ -22,9 +22,7 @@ And, you can learn about API in `util/APIDOCS.md`.
|
|||
- `/errors/error` will change, better error page.
|
||||
- Redirect query.
|
||||
- middleware for timeouts
|
||||
- DELETED USERS: USERLIST
|
||||
- Will fix API
|
||||
- if admin you van see deleted messages.
|
||||
|
||||
## Roadmap
|
||||
### User
|
||||
|
|
|
@ -33,7 +33,7 @@ app.get("/:id", async (req, res) => {
|
|||
|
||||
const messages = await Promise.all(thread.messages.map(async 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 })
|
||||
|
|
|
@ -4,9 +4,8 @@ const app = Router();
|
|||
const error = require("../errors/error");
|
||||
const { UserModel, MessageModel, ThreadModel } = require("../models");
|
||||
|
||||
app.get("/", async (req, res) => {
|
||||
const user = req.user
|
||||
const users = await UserModel.find({ deleted: false });
|
||||
app.get("/", async ({ user }, res) => {
|
||||
const users = await UserModel.find(user.admin ? {} : { deleted: false });
|
||||
return res.render("users", { users, user })
|
||||
|
||||
});
|
||||
|
@ -21,7 +20,7 @@ app.get("/:id", async (req, res) => {
|
|||
|
||||
const message = await MessageModel.count({ authorID: id });
|
||||
const thread = await ThreadModel.count({ authorID: id });
|
||||
res.render("user", { user, member, counts:{ message, thread } })
|
||||
res.render("user", { user, member, counts: { message, thread } })
|
||||
}
|
||||
else error(res, 404, "We have not got this user.");
|
||||
|
||||
|
|
Loading…
Reference in a new issue