feat: move website/location fields into custom user fields

This commit is contained in:
Barış Soner Uşaklı
2024-11-25 18:29:48 -05:00
parent 206613dd63
commit 669c9c5027
14 changed files with 73 additions and 59 deletions

View File

@@ -94,9 +94,10 @@ async function getUsers(req, res) {
const set = buildSet();
const uids = await getUids(set);
const [count, users] = await Promise.all([
const [count, users, customUserFields] = await Promise.all([
getCount(set),
loadUserInfo(req.uid, uids),
getCustomUserFields(),
]);
await render(req, res, {
@@ -106,9 +107,15 @@ async function getUsers(req, res) {
resultsPerPage: resultsPerPage,
reverse: reverse,
sortBy: sortBy,
customUserFields,
});
}
async function getCustomUserFields() {
const keys = await db.getSortedSetRange('user-custom-fields', 0, -1);
return (await db.getObjects(keys.map(k => `user-custom-field:${k}`))).filter(Boolean);
}
usersController.search = async function (req, res) {
const sortDirection = req.query.sortDirection || 'desc';
const reverse = sortDirection === 'desc';