Skip to content

Node.js based forum software built for the modern web

Groups.getGroupsAndMembers

psychobunny2516be620bb6
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]]'));