mirror of
https://github.com/Akif9748/akf-forum.git
synced 2024-11-22 20:10:40 +03:00
Added me
support for ID's
This commit is contained in:
parent
f6cafd17b9
commit
29f8af1394
1 changed files with 3 additions and 0 deletions
|
@ -5,6 +5,9 @@ const { themes, emailRegEx } = require("../../../lib")
|
||||||
const app = Router();
|
const app = Router();
|
||||||
const { join } = require("path");
|
const { join } = require("path");
|
||||||
app.param("id", async (req, res, next, id) => {
|
app.param("id", async (req, res, next, id) => {
|
||||||
|
if (id === "me")
|
||||||
|
id = req.user.id;
|
||||||
|
|
||||||
req.member = await UserModel.get(id, req.user.admin ? "+lastSeen +ips" : "");
|
req.member = await UserModel.get(id, req.user.admin ? "+lastSeen +ips" : "");
|
||||||
|
|
||||||
if (!req.member) return res.error(404, `We don't have any user with id ${id}.`);
|
if (!req.member) return res.error(404, `We don't have any user with id ${id}.`);
|
||||||
|
|
Loading…
Reference in a new issue