From 2516be620bb6546caa2d3c2c4656e9a33f227eef Mon Sep 17 00:00:00 2001 From: psychobunny Date: Mon, 14 Sep 2015 15:10:10 -0400 Subject: [PATCH] Groups.getGroupsAndMembers --- src/groups.js | 48 ++++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/src/groups.js b/src/groups.js index 24ee5a9fd8..5405a9b115 100644 --- a/src/groups.js +++ b/src/groups.js @@ -80,28 +80,7 @@ var async = require('async'), }); } - async.parallel({ - groups: function(next) { - Groups.getGroupsData(groupNames, next); - }, - members: function(next) { - Groups.getMemberUsers(groupNames, 0, 3, next); - } - }, function (err, data) { - if (err) { - return callback(err); - } - data.groups.forEach(function(group, index) { - if (!group) { - return; - } - Groups.escapeGroupData(group); - group.members = data.members[index] || []; - group.truncated = group.memberCount > data.members.length; - }); - - callback(null, data.groups); - }); + Groups.getGroupsAndMembers(groupNames, callback); } }; @@ -109,6 +88,31 @@ var async = require('async'), db.getSortedSetRevRange(set, start, stop, callback); }; + Groups.getGroupsAndMembers = function(groupNames, callback) { + async.parallel({ + groups: function(next) { + Groups.getGroupsData(groupNames, next); + }, + members: function(next) { + Groups.getMemberUsers(groupNames, 0, 3, next); + } + }, function (err, data) { + if (err) { + return callback(err); + } + data.groups.forEach(function(group, index) { + if (!group) { + return; + } + Groups.escapeGroupData(group); + group.members = data.members[index] || []; + group.truncated = group.memberCount > data.members.length; + }); + + callback(null, data.groups); + }); + }; + Groups.get = function(groupName, options, callback) { if (!groupName) { return callback(new Error('[[error:invalid-group]]'));