Updated membercount checks (#10006)

* Updated membercount checks

* Added get member count method

* Updated tests to correctly add users
This commit is contained in:
Keith Holliday
2018-02-26 13:03:04 -07:00
committed by GitHub
parent 6118336a5d
commit 7dcd550209
5 changed files with 39 additions and 9 deletions

View File

@@ -442,6 +442,16 @@ schema.methods.isMember = function isGroupMember (user) {
}
};
schema.methods.getMemberCount = async function getMemberCount () {
let query = { guilds: this._id };
if (this.type === 'party') {
query = { 'party._id': this._id };
}
return await User.count(query).exec();
};
export function chatDefaults (msg, user) {
let message = {
id: shared.uuid(),