|
|
@ -219,9 +219,8 @@
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
Groups.hide = function(groupName, callback) {
|
|
|
|
Groups.hide = function(groupName, callback) {
|
|
|
|
Groups.update(groupName, {
|
|
|
|
callback = callback || function() {};
|
|
|
|
hidden: '1'
|
|
|
|
db.setObjectField('group:' + groupName, 'hidden', 1, callback);
|
|
|
|
}, callback);
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
Groups.update = function(groupName, values, callback) {
|
|
|
|
Groups.update = function(groupName, values, callback) {
|
|
|
@ -265,7 +264,7 @@
|
|
|
|
winston.error('[groups.join] Could not create new hidden group: ' + err.message);
|
|
|
|
winston.error('[groups.join] Could not create new hidden group: ' + err.message);
|
|
|
|
return callback(err);
|
|
|
|
return callback(err);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Groups.hide(groupName);
|
|
|
|
db.setAdd('group:' + groupName + ':members', uid, callback);
|
|
|
|
db.setAdd('group:' + groupName + ':members', uid, callback);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -316,11 +315,14 @@
|
|
|
|
var keys = groupObj.members.map(function(uid) {
|
|
|
|
var keys = groupObj.members.map(function(uid) {
|
|
|
|
return 'uid:' + uid + ':posts';
|
|
|
|
return 'uid:' + uid + ':posts';
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
db.getSortedSetRevUnion(keys, 0, max-1, function(err, pids) {
|
|
|
|
db.getSortedSetRevUnion(keys, 0, max-1, function(err, pids) {
|
|
|
|
posts.getPostSummaryByPids(pids, false, function(err, posts) {
|
|
|
|
if (err) {
|
|
|
|
callback(null, posts);
|
|
|
|
return callback(err);
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
posts.getPostSummaryByPids(pids, false, callback);
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -357,5 +359,5 @@
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}(module.exports));
|
|
|
|
}(module.exports));
|
|
|
|