refactor: pass only needed data

v1.18.x
Barış Soner Uşaklı 5 years ago
parent 9f346c53ab
commit f1974fb900

@ -58,7 +58,6 @@ module.exports = function (Groups) {
...data,
paginate: false,
hardCap: -1,
groupName: data.groupName,
});
const uids = results.users.map(user => user && user.uid);

@ -326,7 +326,6 @@ SocketGroups.loadMore = async (socket, data) => {
};
SocketGroups.searchMembers = async (socket, data) => {
data.uid = socket.uid;
const [isOwner, isMember, isAdmin] = await Promise.all([
groups.ownership.isOwner(socket.uid, data.groupName),
groups.isMember(socket.uid, data.groupName),
@ -335,7 +334,11 @@ SocketGroups.searchMembers = async (socket, data) => {
if (!isOwner && !isMember && !isAdmin) {
throw new Error('[[error:no-privileges]]');
}
return await groups.searchMembers(data);
return await groups.searchMembers({
uid: socket.uid,
query: data.query,
groupName: data.groupName,
});
};
SocketGroups.loadMoreMembers = async (socket, data) => {

Loading…
Cancel
Save