mirror of
https://github.com/Akif9748/akf-forum.git
synced 2024-11-29 22:20:41 +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.
|
- `/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
|
||||||
|
|
|
@ -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 })
|
||||||
|
|
|
@ -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 })
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -21,7 +20,7 @@ app.get("/:id", async (req, res) => {
|
||||||
|
|
||||||
const message = await MessageModel.count({ authorID: id });
|
const message = await MessageModel.count({ authorID: id });
|
||||||
const thread = await ThreadModel.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.");
|
else error(res, 404, "We have not got this user.");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue