mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
feat: allow user.exists to respond to requests for remote uids too
This commit is contained in:
@@ -43,11 +43,13 @@ require('./blocks')(User);
|
||||
require('./uploads')(User);
|
||||
|
||||
User.exists = async function (uids) {
|
||||
return await (
|
||||
Array.isArray(uids) ?
|
||||
db.isSortedSetMembers('users:joindate', uids) :
|
||||
db.isSortedSetMember('users:joindate', uids)
|
||||
);
|
||||
const singular = !Array.isArray(uids);
|
||||
uids = singular ? [uids] : uids;
|
||||
|
||||
let results = await Promise.all(uids.map(async uid => await db.isMemberOfSortedSets(['users:joindate', 'usersRemote:lastCrawled'], uid)));
|
||||
results = results.map(set => set.some(Boolean));
|
||||
|
||||
return singular ? results.pop() : results;
|
||||
};
|
||||
|
||||
User.existsBySlug = async function (userslug) {
|
||||
|
||||
Reference in New Issue
Block a user