v3: move tavern to valid UUID and set Leslie as the leader
This commit is contained in:
@@ -5,6 +5,7 @@ import { model as Challenge } from '../../models/challenge';
|
||||
import {
|
||||
model as Group,
|
||||
basicFields as basicGroupFields,
|
||||
TAVERN_ID,
|
||||
} from '../../models/group';
|
||||
import {
|
||||
model as User,
|
||||
@@ -54,7 +55,7 @@ api.createChallenge = {
|
||||
throw new NotAuthorized(res.t('onlyGroupLeaderChal'));
|
||||
}
|
||||
|
||||
if (groupId === 'habitrpg' && prize < 1) {
|
||||
if (group._id === TAVERN_ID && prize < 1) {
|
||||
throw new NotAuthorized(res.t('pubChalsMinPrize'));
|
||||
}
|
||||
|
||||
@@ -454,7 +455,7 @@ export async function _closeChal (challenge, broken = {}) {
|
||||
await Challenge.remove({_id: challenge._id}).exec();
|
||||
|
||||
// Refund the leader if the challenge is closed and the group not the tavern
|
||||
if (challenge.group !== 'habitrpg' && brokenReason === 'CHALLENGE_DELETED') {
|
||||
if (challenge.group !== TAVERN_ID && brokenReason === 'CHALLENGE_DELETED') {
|
||||
await User.update({_id: challenge.leader}, {$inc: {balance: challenge.prize / 4}}).exec();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { authWithHeaders } from '../../middlewares/api-v3/auth';
|
||||
import cron from '../../middlewares/api-v3/cron';
|
||||
import { model as Group } from '../../models/group';
|
||||
import {
|
||||
model as Group,
|
||||
TAVERN_ID,
|
||||
} from '../../models/group';
|
||||
import { model as User } from '../../models/user';
|
||||
import {
|
||||
NotFound,
|
||||
@@ -23,7 +26,7 @@ let api = {};
|
||||
* @apiName GetChat
|
||||
* @apiGroup Chat
|
||||
*
|
||||
* @apiParam {string} groupId The group _id (or 'party')
|
||||
* @apiParam {string} groupId The group _id ('party' for the user party and 'habitrpg' for tavern are accepted)
|
||||
*
|
||||
* @apiSuccess {Array} chat An array of chat messages
|
||||
*/
|
||||
@@ -219,7 +222,7 @@ api.flagChat = {
|
||||
}
|
||||
|
||||
let groupUrl;
|
||||
if (group._id === 'habitrpg') {
|
||||
if (group._id === TAVERN_ID) {
|
||||
groupUrl = '/#/options/groups/tavern';
|
||||
} else if (group.type === 'guild') {
|
||||
groupUrl = `/#/options/groups/guilds/{$group._id}`;
|
||||
@@ -336,7 +339,7 @@ api.seenChat = {
|
||||
* @apiName DeleteChat
|
||||
* @apiGroup Chat
|
||||
*
|
||||
* @apiParam {string} groupId The group _id (or 'party')
|
||||
* @apiParam {string} groupId The group _id ('party' for the user party and 'habitrpg' for tavern are accepted)
|
||||
* @apiParam {string} chatId The chat _id
|
||||
*
|
||||
* @apiSuccess {Array} The update chat array
|
||||
|
||||
@@ -118,7 +118,7 @@ api.getGroups = {
|
||||
* @apiName GetGroup
|
||||
* @apiGroup Group
|
||||
*
|
||||
* @apiParam {string} groupId The group _id (or 'party')
|
||||
* @apiParam {string} groupId The group _id ('party' for the user party and 'habitrpg' for tavern are accepted)
|
||||
*
|
||||
* @apiSuccess {Object} group The group object
|
||||
*/
|
||||
@@ -152,7 +152,7 @@ api.getGroup = {
|
||||
* @apiName UpdateGroup
|
||||
* @apiGroup Group
|
||||
*
|
||||
* @apiParam {string} groupId The group _id (or 'party')
|
||||
* @apiParam {string} groupId The group _id ('party' for the user party and 'habitrpg' for tavern are accepted)
|
||||
*
|
||||
* @apiSuccess {Object} group The updated group object
|
||||
*/
|
||||
@@ -334,7 +334,7 @@ api.rejectGroupInvite = {
|
||||
* @apiName LeaveGroup
|
||||
* @apiGroup Group
|
||||
*
|
||||
* @apiParam {string} groupId The group _id (or 'party')
|
||||
* @apiParam {string} groupId The group _id ('party' for the user party and 'habitrpg' for tavern are accepted)
|
||||
* @apiParam {string="remove-all","keep-all"} keep Wheter to keep or not challenges' tasks, as an optional query string
|
||||
*
|
||||
* @apiSuccess {Object} empty An empty object
|
||||
@@ -390,7 +390,7 @@ function _sendMessageToRemoved (group, removedUser, message) {
|
||||
* @apiName RemoveGroupMember
|
||||
* @apiGroup Group
|
||||
*
|
||||
* @apiParam {string} groupId The group _id (or 'party')
|
||||
* @apiParam {string} groupId The group _id ('party' for the user party and 'habitrpg' for tavern are accepted)
|
||||
* @apiParam {UUID} memberId The _id of the member to remove
|
||||
* @apiParam {string} message The message to send to the removed members, as a query string // TODO in req.body?
|
||||
*
|
||||
@@ -591,7 +591,7 @@ async function _inviteByEmail (invite, group, inviter, req, res) {
|
||||
* @apiName InviteToGroup
|
||||
* @apiGroup Group
|
||||
*
|
||||
* @apiParam {string} groupId The group _id (or 'party')
|
||||
* @apiParam {string} groupId The group _id ('party' for the user party and 'habitrpg' for tavern are accepted)
|
||||
*
|
||||
* @apiParam {array} emails An array of emails addresses to invite (optional) (inside body)
|
||||
* @apiParam {array} uuids An array of uuids to invite (optional) (inside body)
|
||||
|
||||
Reference in New Issue
Block a user