mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
prevents a user who has had their chat privileges revoked from creating a public guild (#10205)
This commit is contained in:
@@ -78,9 +78,10 @@ let api = {};
|
||||
* "privacy": "private"
|
||||
* }
|
||||
*
|
||||
* @apiError (400) {NotAuthorized} messageInsufficientGems User does not have enough gems (4)
|
||||
* @apiError (400) {NotAuthorized} partyMustbePrivate Party must have privacy set to private
|
||||
* @apiError (400) {NotAuthorized} messageGroupAlreadyInParty
|
||||
* @apiError (401) {NotAuthorized} messageInsufficientGems User does not have enough gems (4)
|
||||
* @apiError (401) {NotAuthorized} partyMustbePrivate Party must have privacy set to private
|
||||
* @apiError (401) {NotAuthorized} messageGroupAlreadyInParty
|
||||
* @apiError (401) {NotAuthorized} cannotCreatePublicGuildWhenMuted You cannot create a public guild because your chat privileges have been revoked.
|
||||
*
|
||||
* @apiSuccess (201) {Object} data The created group (See <a href="https://github.com/HabitRPG/habitica/blob/develop/website/server/models/group.js" target="_blank">/website/server/models/group.js</a>)
|
||||
*
|
||||
@@ -115,6 +116,7 @@ api.createGroup = {
|
||||
group.leader = user._id;
|
||||
|
||||
if (group.type === 'guild') {
|
||||
if (group.privacy === 'public' && user.flags.chatRevoked) throw new NotAuthorized(res.t('cannotCreatePublicGuildWhenMuted'));
|
||||
if (user.balance < 1) throw new NotAuthorized(res.t('messageInsufficientGems'));
|
||||
|
||||
group.balance = 1;
|
||||
|
||||
Reference in New Issue
Block a user