Limit party size to 30 members (#8589)

* Added a field in Party page with members count and maximum members in party

* Added information of invitations counter

* Limited party to 2 members on server (API)

* Fixed english text

* Consider current number of invitations in the party

* Moved PARTY_LIMIT_MEMBERS to common folder

* Access the PARTY_LIMIT_MEMBERS through groupsCtrl

* Some corrections

* Hide invite button when invite limit is reached

* Added missing trailing comma

* Do not test 'returns only first 30 invites' in a party anymore, but in a guild: party is limited to 30 members, so it would always fail

* Test: allow 30 members in a party

* Test: do not allow 30+ members in a party

* Improved 'allow 30 members in a party' test

* Test: 'allow 30+ members in a guild'

* Added missing trailing comma

* Code style corrections

* Fixed new line position

* Party limit check done inside Group.validateInvitations function

* Improved members count query

* Fixed tests

* Rewrite tests

* Removed import of BadRequest: value became unused

* Added 'await' to remaining 'Group.validateInvitations' functions

* Fixed tests that would always success
This commit is contained in:
Mateus Etto
2017-03-26 16:23:19 -03:00
committed by Matteo Pagliazzi
parent 02708a7b10
commit b0eda344f1
10 changed files with 156 additions and 103 deletions

View File

@@ -1038,6 +1038,7 @@ async function _inviteByEmail (invite, group, inviter, req, res) {
* @apiError (400) {BadRequest} MustBeArray The `uuids` or `emails` body param was not an array.
* @apiError (400) {BadRequest} TooManyInvites A max of 100 invites (combined emails and user ids) can
* be sent out at a time.
* @apiError (400) {BadRequest} ExceedsMembersLimit A max of 30 members can join a party.
*
* @apiError (401) {NotAuthorized} UserAlreadyInvited The user has already been invited to the group.
* @apiError (401) {NotAuthorized} UserAlreadyInGroup The user is already a member of the group.
@@ -1066,7 +1067,7 @@ api.inviteToGroup = {
let uuids = req.body.uuids;
let emails = req.body.emails;
Group.validateInvitations(uuids, emails, res);
await Group.validateInvitations(uuids, emails, res, group);
let results = [];