diff --git a/README.md b/README.md index 2db25f6..f87183f 100644 --- a/README.md +++ b/README.md @@ -52,16 +52,15 @@ Akf-forum has got an API for AJAX (fetch), other clients etc. And, you can learn - categories page is need a update, thread count in category - Disable last seen button for web. - old contents / titles add to forum interface -- add ban button to user profile. +- add ban button to user profile.? - change password. - add approval threads page. - who liked a message for web. - edit config from web admin panel. -- user.state for ban, delete, etc. - Add a feature list to README.md - delete admin??? - change category name - +- theme support++, directly edit html! ## Major Version History - V4: Caching - V3: New Theme diff --git a/routes/api/routes/users.js b/routes/api/routes/users.js index 0fcd2bf..fcc9132 100644 --- a/routes/api/routes/users.js +++ b/routes/api/routes/users.js @@ -38,7 +38,7 @@ app.patch("/:id", async (req, res) => { if (req.user.id !== member.id && !user.admin) return res.error(403, "You have not got permission for this."); if (!Object.keys(req.body).some(Boolean)) return res.error(400, "Missing member informations in request body."); - const { name, about, theme, admin, deleted } = req.body; + const { name, about, theme, admin, deleted, hideLastSeen } = req.body; if ((admin?.length || "deleted" in req.body) && !req.user.admin) return res.error(403, "You have not got permission for edit 'admin' and 'deleted' information, or bad request."); const { names, desp } = req.app.get("limits"); @@ -56,6 +56,9 @@ app.patch("/:id", async (req, res) => { if (typeof admin === "boolean" || ["false", "true"].includes(admin)) member.admin = admin; if (deleted === false) member.deleted = false; + + if (typeof hideLastSeen === "boolean") member.hideLastSeen = hideLastSeen; + member.edited = true; res.complate(await member.save()); @@ -67,8 +70,8 @@ app.post("/:id/ban", async (req, res) => { const { member } = req; for (const ip of member.ips) try { - await BanModel.create({ ip, reason: `Ban for ${member.name}`, authorID: req.user.id }); - req.app.ips.push(ip); + await BanModel.create({ ip, reason: `Ban for ${member.name}`, authorID: req.user.id }); + req.app.ips.push(ip); } catch { continue; } diff --git a/views/user.ejs b/views/user.ejs index d11ccfd..7df3dc0 100644 --- a/views/user.ejs +++ b/views/user.ejs @@ -13,99 +13,116 @@