diff --git a/common/index.js b/common/index.js index 6aca241e03..04189fa8ab 100644 --- a/common/index.js +++ b/common/index.js @@ -2,7 +2,7 @@ let pathToCommon; -if (process.env.NODE_ENV === 'production') { +if (process.env.NODE_ENV === 'production') { // eslint-disable-line no-process-env pathToCommon = './transpiled-babel/index'; } else { pathToCommon = './script/index'; diff --git a/common/script/fns/autoAllocate.js b/common/script/fns/autoAllocate.js index 3d680d282d..85fe01b78d 100644 --- a/common/script/fns/autoAllocate.js +++ b/common/script/fns/autoAllocate.js @@ -11,26 +11,31 @@ function getStatToAllocate (user) { let suggested; switch (user.preferences.allocationMode) { - case 'flat': + case 'flat': { let stats = _.pick(user.stats, splitWhitespace('con str per int')); return _.invert(stats)[_.min(stats)]; - case 'classbased': + } + case 'classbased': { let lvlDiv7 = user.stats.lvl / 7; let ideal = [lvlDiv7 * 3, lvlDiv7 * 2, lvlDiv7, lvlDiv7]; let preference; switch (user.stats.class) { - case 'wizard': + case 'wizard': { preference = ['int', 'per', 'con', 'str']; break; - case 'rogue': + } + case 'rogue': { preference = ['per', 'str', 'int', 'con']; break; - case 'healer': + } + case 'healer': { preference = ['con', 'int', 'str', 'per']; break; - default: + } + default: { preference = ['str', 'con', 'per', 'int']; + } } let diff = [ @@ -45,7 +50,8 @@ function getStatToAllocate (user) { }); return suggested !== -1 ? preference[suggested] : 'str'; - case 'taskbased': + } + case 'taskbased': { suggested = _.invert(user.stats.training)[_.max(user.stats.training)]; let training = user.stats.training; @@ -55,8 +61,10 @@ function getStatToAllocate (user) { training.per = 0; return suggested || 'str'; - default: + } + default: { return 'str'; + } } } diff --git a/common/script/ops/equip.js b/common/script/ops/equip.js index 94a40331d2..ddef7c5483 100644 --- a/common/script/ops/equip.js +++ b/common/script/ops/equip.js @@ -21,24 +21,24 @@ module.exports = function equip (user, req = {}) { let message; switch (type) { - case 'mount': + case 'mount': { if (!user.items.mounts[key]) { throw new NotFound(i18n.t('mountNotOwned', req.language)); } user.items.currentMount = user.items.currentMount === key ? '' : key; break; - - case 'pet': + } + case 'pet': { if (!user.items.pets[key]) { throw new NotFound(i18n.t('petNotOwned', req.language)); } user.items.currentPet = user.items.currentPet === key ? '' : key; break; - + } case 'costume': - case 'equipped': + case 'equipped': { if (!user.items.gear.owned[key]) { throw new NotFound(i18n.t('gearNotOwned', req.language)); } @@ -55,6 +55,7 @@ module.exports = function equip (user, req = {}) { message = handleTwoHanded(user, item, type, req); } break; + } } let res = { diff --git a/test/api/v2/user/tasks/POST-clear-completed.test.js b/test/api/v2/user/tasks/POST-clear-completed.test.js index be7f39a203..40e6cbd5cf 100644 --- a/test/api/v2/user/tasks/POST-clear-completed.test.js +++ b/test/api/v2/user/tasks/POST-clear-completed.test.js @@ -19,8 +19,8 @@ describe('POST /user/tasks/clear-completed', () => { await user.post(`/user/tasks/${toComplete._id}/up`); - let todos = await user.get(`/user/tasks?type=todo`); - let uncomplete = await user.post(`/user/tasks/clear-completed`); + let todos = await user.get('/user/tasks?type=todo'); + let uncomplete = await user.post('/user/tasks/clear-completed'); expect(todos.length).to.equal(uncomplete.length + 1); }); }); diff --git a/test/api/v3/integration/challenges/DELETE-challenges_challengeId.test.js b/test/api/v3/integration/challenges/DELETE-challenges_challengeId.test.js index 44ff6a8b58..45dc91758a 100644 --- a/test/api/v3/integration/challenges/DELETE-challenges_challengeId.test.js +++ b/test/api/v3/integration/challenges/DELETE-challenges_challengeId.test.js @@ -11,7 +11,7 @@ import { v4 as generateUUID } from 'uuid'; describe('DELETE /challenges/:challengeId', () => { it('returns error when challengeId is not a valid UUID', async () => { let user = await generateUser(); - await expect(user.del(`/challenges/test`)).to.eventually.be.rejected.and.eql({ + await expect(user.del('/challenges/test')).to.eventually.be.rejected.and.eql({ code: 400, error: 'BadRequest', message: t('invalidReqParams'), diff --git a/test/api/v3/integration/challenges/GET-challenges_user.test.js b/test/api/v3/integration/challenges/GET-challenges_user.test.js index 21ae0aa96b..cf8ed3b667 100644 --- a/test/api/v3/integration/challenges/GET-challenges_user.test.js +++ b/test/api/v3/integration/challenges/GET-challenges_user.test.js @@ -29,7 +29,7 @@ describe('GET challenges/user', () => { it('should return challenges user has joined', async () => { await nonMember.post(`/challenges/${challenge._id}/join`); - let challenges = await nonMember.get(`/challenges/user`); + let challenges = await nonMember.get('/challenges/user'); let foundChallenge = _.find(challenges, { _id: challenge._id }); expect(foundChallenge).to.exist; @@ -46,7 +46,7 @@ describe('GET challenges/user', () => { }); it('should return challenges user has created', async () => { - let challenges = await user.get(`/challenges/user`); + let challenges = await user.get('/challenges/user'); let foundChallenge1 = _.find(challenges, { _id: challenge._id }); expect(foundChallenge1).to.exist; @@ -75,7 +75,7 @@ describe('GET challenges/user', () => { }); it('should return challenges in user\'s group', async () => { - let challenges = await member.get(`/challenges/user`); + let challenges = await member.get('/challenges/user'); let foundChallenge1 = _.find(challenges, { _id: challenge._id }); expect(foundChallenge1).to.exist; @@ -114,7 +114,7 @@ describe('GET challenges/user', () => { let privateChallenge = await generateChallenge(groupLeader, group); - let challenges = await nonMember.get(`/challenges/user`); + let challenges = await nonMember.get('/challenges/user'); let foundChallenge = _.find(challenges, { _id: privateChallenge._id }); expect(foundChallenge).to.not.exist; diff --git a/test/api/v3/integration/challenges/POST-challenges.test.js b/test/api/v3/integration/challenges/POST-challenges.test.js index 2f4878d91a..1b80266ab7 100644 --- a/test/api/v3/integration/challenges/POST-challenges.test.js +++ b/test/api/v3/integration/challenges/POST-challenges.test.js @@ -19,7 +19,7 @@ describe('POST /challenges', () => { it('returns error when groupId is not for a valid group', async () => { let user = await generateUser(); - await expect(user.post(`/challenges`, { + await expect(user.post('/challenges', { group: generateUUID(), })).to.eventually.be.rejected.and.eql({ code: 404, @@ -31,7 +31,7 @@ describe('POST /challenges', () => { it('returns error when creating a challenge in the tavern with no prize', async () => { let user = await generateUser(); - await expect(user.post(`/challenges`, { + await expect(user.post('/challenges', { group: 'habitrpg', prize: 0, })).to.eventually.be.rejected.and.eql({ @@ -50,7 +50,7 @@ describe('POST /challenges', () => { }, }); - await expect(user.post(`/challenges`, { + await expect(user.post('/challenges', { group: group._id, prize: 4, })).to.eventually.be.rejected.and.eql({ @@ -85,7 +85,7 @@ describe('POST /challenges', () => { }); it('returns an error when non-leader member creates a challenge in leaderOnly group', async () => { - await expect(groupMember.post(`/challenges`, { + await expect(groupMember.post('/challenges', { group: group._id, })).to.eventually.be.rejected.and.eql({ code: 401, @@ -95,7 +95,7 @@ describe('POST /challenges', () => { }); it('returns an error when non-leader member creates a challenge in leaderOnly group', async () => { - await expect(groupMember.post(`/challenges`, { + await expect(groupMember.post('/challenges', { group: group._id, })).to.eventually.be.rejected.and.eql({ code: 401, @@ -112,7 +112,7 @@ describe('POST /challenges', () => { group = populatedGroup.group; groupMember = populatedGroup.members[0]; - let chal = await groupMember.post(`/challenges`, { + let chal = await groupMember.post('/challenges', { group: group._id, name: 'Test Challenge', shortName: 'TC', @@ -128,7 +128,7 @@ describe('POST /challenges', () => { let oldUserBalance = groupLeader.balance; let oldGroupBalance = group.balance; - await groupLeader.post(`/challenges`, { + await groupLeader.post('/challenges', { group: group._id, name: 'Test Challenge', shortName: 'TC', @@ -140,7 +140,7 @@ describe('POST /challenges', () => { }); it('returns error when user and group can\'t pay prize', async () => { - await expect(groupLeader.post(`/challenges`, { + await expect(groupLeader.post('/challenges', { group: group._id, name: 'Test Challenge', shortName: 'TC', @@ -157,7 +157,7 @@ describe('POST /challenges', () => { let oldGroupBalance = group.balance; let prize = 4; - await groupLeader.post(`/challenges`, { + await groupLeader.post('/challenges', { group: group._id, name: 'Test Challenge', shortName: 'TC', @@ -172,7 +172,7 @@ describe('POST /challenges', () => { let oldUserBalance = groupLeader.balance; let prize = 8; - await groupLeader.post(`/challenges`, { + await groupLeader.post('/challenges', { group: group._id, name: 'Test Challenge', shortName: 'TC', @@ -188,7 +188,7 @@ describe('POST /challenges', () => { let prize = 8; await group.update({ balance: 0}); - await groupLeader.post(`/challenges`, { + await groupLeader.post('/challenges', { group: group._id, name: 'Test Challenge', shortName: 'TC', @@ -202,7 +202,7 @@ describe('POST /challenges', () => { it('increases challenge count of group', async () => { let oldChallengeCount = group.challengeCount; - await groupLeader.post(`/challenges`, { + await groupLeader.post('/challenges', { group: group._id, name: 'Test Challenge', shortName: 'TC', @@ -218,7 +218,7 @@ describe('POST /challenges', () => { }, }); - let challenge = await groupLeader.post(`/challenges`, { + let challenge = await groupLeader.post('/challenges', { group: group._id, name: 'Test Challenge', shortName: 'TC', @@ -229,7 +229,7 @@ describe('POST /challenges', () => { }); it('doesn\'t set challenge as official if official flag is set by non-admin', async () => { - let challenge = await groupLeader.post(`/challenges`, { + let challenge = await groupLeader.post('/challenges', { group: group._id, name: 'Test Challenge', shortName: 'TC', @@ -245,7 +245,7 @@ describe('POST /challenges', () => { let oldUserChallenges = groupLeader.challenges; let oldGroupBalance = group.balance; - await expect(groupLeader.post(`/challenges`, { + await expect(groupLeader.post('/challenges', { group: group._id, prize: 8, })).to.eventually.be.rejected.and.eql({ @@ -269,7 +269,7 @@ describe('POST /challenges', () => { let description = 'Test Description'; let prize = 4; - let challenge = await groupLeader.post(`/challenges`, { + let challenge = await groupLeader.post('/challenges', { group: group._id, name, shortName, @@ -296,7 +296,7 @@ describe('POST /challenges', () => { }); it('adds challenge to creator\'s challenges', async () => { - let challenge = await groupLeader.post(`/challenges`, { + let challenge = await groupLeader.post('/challenges', { group: group._id, name: 'Test Challenge', shortName: 'TC', diff --git a/test/api/v3/integration/coupons/GET-coupons.test.js b/test/api/v3/integration/coupons/GET-coupons.test.js index 775ddfc3fe..6008d2b1df 100644 --- a/test/api/v3/integration/coupons/GET-coupons.test.js +++ b/test/api/v3/integration/coupons/GET-coupons.test.js @@ -16,7 +16,7 @@ describe('GET /coupons/', () => { it('returns an error if user has no sudo permission', async () => { await user.get('/user'); // needed so the request after this will authenticate with the correct cookie session - await expect(user.get(`/coupons`)).to.eventually.be.rejected.and.eql({ + await expect(user.get('/coupons')).to.eventually.be.rejected.and.eql({ code: 401, error: 'NotAuthorized', message: t('noSudoAccess'), @@ -29,7 +29,7 @@ describe('GET /coupons/', () => { }); let coupons = await user.post('/coupons/generate/wondercon?count=11'); - let res = await user.get(`/coupons`); + let res = await user.get('/coupons'); let splitRes = res.split('\n'); expect(splitRes.length).to.equal(13); diff --git a/test/api/v3/integration/coupons/POST-coupons_enter_code.test.js b/test/api/v3/integration/coupons/POST-coupons_enter_code.test.js index 687ada750b..e1f9db3583 100644 --- a/test/api/v3/integration/coupons/POST-coupons_enter_code.test.js +++ b/test/api/v3/integration/coupons/POST-coupons_enter_code.test.js @@ -20,7 +20,7 @@ describe('POST /coupons/enter/:code', () => { }); it('returns an error if code is missing', async () => { - await expect(user.post(`/coupons/enter`)).to.eventually.be.rejected.and.eql({ + await expect(user.post('/coupons/enter')).to.eventually.be.rejected.and.eql({ code: 404, error: 'NotFound', message: 'Not found.', @@ -28,7 +28,7 @@ describe('POST /coupons/enter/:code', () => { }); it('returns an error if code is invalid', async () => { - await expect(user.post(`/coupons/enter/notValid`)).to.eventually.be.rejected.and.eql({ + await expect(user.post('/coupons/enter/notValid')).to.eventually.be.rejected.and.eql({ code: 400, error: 'BadRequest', message: t('invalidCoupon'), diff --git a/test/api/v3/integration/coupons/POST-coupons_generate_event.test.js b/test/api/v3/integration/coupons/POST-coupons_generate_event.test.js index 005a78923f..27bbc5c4f7 100644 --- a/test/api/v3/integration/coupons/POST-coupons_generate_event.test.js +++ b/test/api/v3/integration/coupons/POST-coupons_generate_event.test.js @@ -22,7 +22,7 @@ describe('POST /coupons/generate/:event', () => { 'contributor.sudo': false, }); - await expect(user.post(`/coupons/generate/aaa`)).to.eventually.be.rejected.and.eql({ + await expect(user.post('/coupons/generate/aaa')).to.eventually.be.rejected.and.eql({ code: 401, error: 'NotAuthorized', message: t('noSudoAccess'), @@ -30,7 +30,7 @@ describe('POST /coupons/generate/:event', () => { }); it('returns an error if event is missing', async () => { - await expect(user.post(`/coupons/generate`)).to.eventually.be.rejected.and.eql({ + await expect(user.post('/coupons/generate')).to.eventually.be.rejected.and.eql({ code: 404, error: 'NotFound', message: 'Not found.', @@ -38,7 +38,7 @@ describe('POST /coupons/generate/:event', () => { }); it('returns an error if event is invalid', async () => { - await expect(user.post(`/coupons/generate/notValid?count=1`)).to.eventually.be.rejected.and.eql({ + await expect(user.post('/coupons/generate/notValid?count=1')).to.eventually.be.rejected.and.eql({ code: 400, error: 'BadRequest', message: 'Coupon validation failed', @@ -46,7 +46,7 @@ describe('POST /coupons/generate/:event', () => { }); it('returns an error if count is missing', async () => { - await expect(user.post(`/coupons/generate/notValid`)).to.eventually.be.rejected.and.eql({ + await expect(user.post('/coupons/generate/notValid')).to.eventually.be.rejected.and.eql({ code: 400, error: 'BadRequest', message: t('invalidReqParams'), diff --git a/test/api/v3/integration/coupons/POST-coupons_validate_code.test.js b/test/api/v3/integration/coupons/POST-coupons_validate_code.test.js index 28de4ca460..9d433813ea 100644 --- a/test/api/v3/integration/coupons/POST-coupons_validate_code.test.js +++ b/test/api/v3/integration/coupons/POST-coupons_validate_code.test.js @@ -12,7 +12,7 @@ describe('POST /coupons/validate/:code', () => { }); it('returns an error if code is missing', async () => { - await expect(api.post(`/coupons/validate`)).to.eventually.be.rejected.and.eql({ + await expect(api.post('/coupons/validate')).to.eventually.be.rejected.and.eql({ code: 404, error: 'NotFound', message: 'Not found.', @@ -30,7 +30,7 @@ describe('POST /coupons/validate/:code', () => { }); it('returns false if coupon code is valid', async () => { - let res = await api.post(`/coupons/validate/notValid`); + let res = await api.post('/coupons/validate/notValid'); expect(res).to.eql({valid: false}); }); }); diff --git a/test/api/v3/integration/dataexport/GET-export_avatar-memberId.html.test.js b/test/api/v3/integration/dataexport/GET-export_avatar-memberId.html.test.js index e3bf32c1b6..a7b97390b6 100644 --- a/test/api/v3/integration/dataexport/GET-export_avatar-memberId.html.test.js +++ b/test/api/v3/integration/dataexport/GET-export_avatar-memberId.html.test.js @@ -12,7 +12,7 @@ describe('GET /export/avatar-:memberId.html', () => { }); it('validates req.params.memberId', async () => { - await expect(user.get(`/export/avatar-:memberId.html`)).to.eventually.be.rejected.and.eql({ + await expect(user.get('/export/avatar-:memberId.html')).to.eventually.be.rejected.and.eql({ code: 400, error: 'BadRequest', message: t('invalidReqParams'), diff --git a/test/api/v3/integration/dataexport/GET-export_history.csv.test.js b/test/api/v3/integration/dataexport/GET-export_history.csv.test.js index 8f1caeec7c..2dbc80c49d 100644 --- a/test/api/v3/integration/dataexport/GET-export_history.csv.test.js +++ b/test/api/v3/integration/dataexport/GET-export_history.csv.test.js @@ -34,7 +34,7 @@ describe('GET /export/history.csv', () => { return user.get(`/tasks/${task._id}`); })); - let res = await user.get(`/export/history.csv`); + let res = await user.get('/export/history.csv'); let splitRes = res.split('\n'); expect(splitRes[0]).to.equal('Task Name,Task ID,Task Type,Date,Value'); expect(splitRes[1]).to.equal(`habit 1,${tasks[0]._id},habit,${moment(tasks[0].history[0].date).format('YYYY-MM-DD HH:mm:ss')},${tasks[0].history[0].value}`); diff --git a/test/api/v3/integration/dataexport/GET-export_userdata.json.test.js b/test/api/v3/integration/dataexport/GET-export_userdata.json.test.js index 0701809889..d8152f1209 100644 --- a/test/api/v3/integration/dataexport/GET-export_userdata.json.test.js +++ b/test/api/v3/integration/dataexport/GET-export_userdata.json.test.js @@ -12,7 +12,7 @@ describe('GET /export/userdata.json', () => { {type: 'todo', text: 'todo 1'}, ]); - let res = await user.get(`/export/userdata.json`); + let res = await user.get('/export/userdata.json'); expect(res._id).to.equal(user._id); expect(res).to.contain.all.keys(['tasks', 'flags', 'tasksOrder', 'auth']); expect(res.auth.local).not.to.have.keys(['salt', 'hashed_password']); diff --git a/test/api/v3/integration/dataexport/GET-export_userdata.xml.test.js b/test/api/v3/integration/dataexport/GET-export_userdata.xml.test.js index eb5650a478..61b84cd0ba 100644 --- a/test/api/v3/integration/dataexport/GET-export_userdata.xml.test.js +++ b/test/api/v3/integration/dataexport/GET-export_userdata.xml.test.js @@ -21,7 +21,7 @@ describe('GET /export/userdata.xml', () => { ]); - let response = await user.get(`/export/userdata.xml`); + let response = await user.get('/export/userdata.xml'); let {user: res} = await Q.npost(xml2js, 'parseString', [response, {explicitArray: false}]); expect(res._id).to.equal(user._id); diff --git a/test/api/v3/integration/groups/GET-groups_groupId_invites.test.js b/test/api/v3/integration/groups/GET-groups_groupId_invites.test.js index d1604a4d84..eea2b5fa26 100644 --- a/test/api/v3/integration/groups/GET-groups_groupId_invites.test.js +++ b/test/api/v3/integration/groups/GET-groups_groupId_invites.test.js @@ -13,7 +13,7 @@ describe('GET /groups/:groupId/invites', () => { }); it('validates optional req.query.lastId to be an UUID', async () => { - await expect(user.get(`/groups/groupId/invites?lastId=invalidUUID`)).to.eventually.be.rejected.and.eql({ + await expect(user.get('/groups/groupId/invites?lastId=invalidUUID')).to.eventually.be.rejected.and.eql({ code: 400, error: 'BadRequest', message: t('invalidReqParams'), @@ -42,7 +42,7 @@ describe('GET /groups/:groupId/invites', () => { let group = await generateGroup(user, {type: 'party', name: generateUUID()}); let invited = await generateUser(); await user.post(`/groups/${group._id}/invite`, {uuids: [invited._id]}); - let res = await user.get(`/groups/party/invites`); + let res = await user.get('/groups/party/invites'); expect(res).to.be.an('array'); expect(res.length).to.equal(1); @@ -56,7 +56,7 @@ describe('GET /groups/:groupId/invites', () => { let group = await generateGroup(user, {type: 'party', name: generateUUID()}); let invited = await generateUser(); await user.post(`/groups/${group._id}/invite`, {uuids: [invited._id]}); - let res = await user.get(`/groups/party/invites`); + let res = await user.get('/groups/party/invites'); expect(res[0]).to.have.all.keys(['_id', 'profile']); expect(res[0].profile).to.have.all.keys(['name']); }); @@ -70,7 +70,7 @@ describe('GET /groups/:groupId/invites', () => { let generatedInvites = await Promise.all(invitesToGenerate); await user.post(`/groups/${group._id}/invite`, {uuids: generatedInvites.map(invite => invite._id)}); - let res = await user.get(`/groups/party/invites`); + let res = await user.get('/groups/party/invites'); expect(res.length).to.equal(30); res.forEach(member => { expect(member).to.have.all.keys(['_id', 'profile']); diff --git a/test/api/v3/integration/groups/GET-groups_groupId_members.test.js b/test/api/v3/integration/groups/GET-groups_groupId_members.test.js index 15193db012..1acaf140e8 100644 --- a/test/api/v3/integration/groups/GET-groups_groupId_members.test.js +++ b/test/api/v3/integration/groups/GET-groups_groupId_members.test.js @@ -13,7 +13,7 @@ describe('GET /groups/:groupId/members', () => { }); it('validates optional req.query.lastId to be an UUID', async () => { - await expect(user.get(`/groups/groupId/members?lastId=invalidUUID`)).to.eventually.be.rejected.and.eql({ + await expect(user.get('/groups/groupId/members?lastId=invalidUUID')).to.eventually.be.rejected.and.eql({ code: 400, error: 'BadRequest', message: t('invalidReqParams'), @@ -40,7 +40,7 @@ describe('GET /groups/:groupId/members', () => { it('works when passing party as req.params.groupId', async () => { await generateGroup(user, {type: 'party', name: generateUUID()}); - let res = await user.get(`/groups/party/members`); + let res = await user.get('/groups/party/members'); expect(res).to.be.an('array'); expect(res.length).to.equal(1); expect(res[0]).to.eql({ @@ -51,7 +51,7 @@ describe('GET /groups/:groupId/members', () => { it('populates only some fields', async () => { await generateGroup(user, {type: 'party', name: generateUUID()}); - let res = await user.get(`/groups/party/members`); + let res = await user.get('/groups/party/members'); expect(res[0]).to.have.all.keys(['_id', 'profile']); expect(res[0].profile).to.have.all.keys(['name']); }); @@ -65,7 +65,7 @@ describe('GET /groups/:groupId/members', () => { } await Promise.all(usersToGenerate); - let res = await user.get(`/groups/party/members`); + let res = await user.get('/groups/party/members'); expect(res.length).to.equal(30); res.forEach(member => { expect(member).to.have.all.keys(['_id', 'profile']); diff --git a/test/api/v3/integration/hall/GET-hall_heroes_heroId.test.js b/test/api/v3/integration/hall/GET-hall_heroes_heroId.test.js index ba2bec1783..aef6990bad 100644 --- a/test/api/v3/integration/hall/GET-hall_heroes_heroId.test.js +++ b/test/api/v3/integration/hall/GET-hall_heroes_heroId.test.js @@ -24,7 +24,7 @@ describe('GET /heroes/:heroId', () => { }); it('validates req.params.heroId', async () => { - await expect(user.get(`/hall/heroes/invalidUUID`)).to.eventually.be.rejected.and.eql({ + await expect(user.get('/hall/heroes/invalidUUID')).to.eventually.be.rejected.and.eql({ code: 400, error: 'BadRequest', message: t('invalidReqParams'), diff --git a/test/api/v3/integration/hall/GET-hall_patrons.test.js b/test/api/v3/integration/hall/GET-hall_patrons.test.js index 17fa3fd58d..9599daef89 100644 --- a/test/api/v3/integration/hall/GET-hall_patrons.test.js +++ b/test/api/v3/integration/hall/GET-hall_patrons.test.js @@ -14,7 +14,7 @@ describe('GET /hall/patrons', () => { }); it('fails if req.query.page is not numeric', async () => { - await expect(user.get(`/hall/patrons?page=notNumber`)).to.eventually.be.rejected.and.eql({ + await expect(user.get('/hall/patrons?page=notNumber')).to.eventually.be.rejected.and.eql({ code: 400, error: 'BadRequest', message: t('invalidReqParams'), diff --git a/test/api/v3/integration/hall/PUT-hall_heores_heroId.test.js b/test/api/v3/integration/hall/PUT-hall_heores_heroId.test.js index 391d5cdeee..9948cbe3c7 100644 --- a/test/api/v3/integration/hall/PUT-hall_heores_heroId.test.js +++ b/test/api/v3/integration/hall/PUT-hall_heores_heroId.test.js @@ -24,7 +24,7 @@ describe('PUT /heroes/:heroId', () => { }); it('validates req.params.heroId', async () => { - await expect(user.put(`/hall/heroes/invalidUUID`)).to.eventually.be.rejected.and.eql({ + await expect(user.put('/hall/heroes/invalidUUID')).to.eventually.be.rejected.and.eql({ code: 400, error: 'BadRequest', message: t('invalidReqParams'), diff --git a/test/api/v3/integration/members/GET-members_id.test.js b/test/api/v3/integration/members/GET-members_id.test.js index 9b4c734ea9..e68554fa42 100644 --- a/test/api/v3/integration/members/GET-members_id.test.js +++ b/test/api/v3/integration/members/GET-members_id.test.js @@ -12,7 +12,7 @@ describe('GET /members/:memberId', () => { }); it('validates req.params.memberId', async () => { - await expect(user.get(`/members/invalidUUID`)).to.eventually.be.rejected.and.eql({ + await expect(user.get('/members/invalidUUID')).to.eventually.be.rejected.and.eql({ code: 400, error: 'BadRequest', message: t('invalidReqParams'), diff --git a/test/api/v3/integration/tasks/POST-tasks_id_score_direction.test.js b/test/api/v3/integration/tasks/POST-tasks_id_score_direction.test.js index c1204a7341..86236fd110 100644 --- a/test/api/v3/integration/tasks/POST-tasks_id_score_direction.test.js +++ b/test/api/v3/integration/tasks/POST-tasks_id_score_direction.test.js @@ -94,7 +94,7 @@ describe('POST /tasks/:id/score/:direction', () => { beforeEach(async () => { await user.post(`/tasks/${todo._id}/score/up`); - updatedUser = await user.get(`/user`); + updatedUser = await user.get('/user'); }); it('increases user\'s mp', () => { @@ -115,7 +115,7 @@ describe('POST /tasks/:id/score/:direction', () => { beforeEach(async () => { await user.post(`/tasks/${todo._id}/score/down`); - updatedUser = await user.get(`/user`); + updatedUser = await user.get('/user'); }); it('decreases user\'s mp', () => { @@ -165,7 +165,7 @@ describe('POST /tasks/:id/score/:direction', () => { beforeEach(async () => { await user.post(`/tasks/${daily._id}/score/up`); - updatedUser = await user.get(`/user`); + updatedUser = await user.get('/user'); }); it('increases user\'s mp', () => { @@ -186,7 +186,7 @@ describe('POST /tasks/:id/score/:direction', () => { beforeEach(async () => { await user.post(`/tasks/${daily._id}/score/down`); - updatedUser = await user.get(`/user`); + updatedUser = await user.get('/user'); }); it('decreases user\'s mp', () => { @@ -238,28 +238,28 @@ describe('POST /tasks/:id/score/:direction', () => { it('increases user\'s mp when direction is up', async () => { await user.post(`/tasks/${habit._id}/score/up`); - let updatedUser = await user.get(`/user`); + let updatedUser = await user.get('/user'); expect(updatedUser.stats.mp).to.be.greaterThan(user.stats.mp); }); it('decreases user\'s mp when direction is down', async () => { await user.post(`/tasks/${habit._id}/score/down`); - let updatedUser = await user.get(`/user`); + let updatedUser = await user.get('/user'); expect(updatedUser.stats.mp).to.be.lessThan(user.stats.mp); }); it('increases user\'s exp when direction is up', async () => { await user.post(`/tasks/${habit._id}/score/up`); - let updatedUser = await user.get(`/user`); + let updatedUser = await user.get('/user'); expect(updatedUser.stats.exp).to.be.greaterThan(user.stats.exp); }); it('increases user\'s gold when direction is up', async () => { await user.post(`/tasks/${habit._id}/score/up`); - let updatedUser = await user.get(`/user`); + let updatedUser = await user.get('/user'); expect(updatedUser.stats.gp).to.be.greaterThan(user.stats.gp); }); @@ -276,7 +276,7 @@ describe('POST /tasks/:id/score/:direction', () => { }); await user.post(`/tasks/${reward._id}/score/up`); - updatedUser = await user.get(`/user`); + updatedUser = await user.get('/user'); }); it('purchases reward', () => { diff --git a/test/api/v3/integration/user/POST-user_allocate.test.js b/test/api/v3/integration/user/POST-user_allocate.test.js index 6f3e6347ac..d213318534 100644 --- a/test/api/v3/integration/user/POST-user_allocate.test.js +++ b/test/api/v3/integration/user/POST-user_allocate.test.js @@ -13,7 +13,7 @@ describe('POST /user/allocate', () => { // More tests in common code unit tests it('returns an error if an invalid attribute is supplied', async () => { - await expect(user.post(`/user/allocate?stat=invalid`)) + await expect(user.post('/user/allocate?stat=invalid')) .to.eventually.be.rejected.and.eql({ code: 400, error: 'BadRequest', @@ -22,7 +22,7 @@ describe('POST /user/allocate', () => { }); it('returns an error if the user doesn\'t have attribute points', async () => { - await expect(user.post(`/user/allocate`)) + await expect(user.post('/user/allocate')) .to.eventually.be.rejected.and.eql({ code: 401, error: 'NotAuthorized', @@ -32,7 +32,7 @@ describe('POST /user/allocate', () => { it('allocates attribute points', async () => { await user.update({'stats.points': 1}); - let res = await user.post(`/user/allocate?stat=con`); + let res = await user.post('/user/allocate?stat=con'); await user.sync(); expect(user.stats.con).to.equal(1); expect(user.stats.points).to.equal(0); diff --git a/test/api/v3/integration/user/POST-user_allocate_now.test.js b/test/api/v3/integration/user/POST-user_allocate_now.test.js index 4b649cd187..668c85610e 100644 --- a/test/api/v3/integration/user/POST-user_allocate_now.test.js +++ b/test/api/v3/integration/user/POST-user_allocate_now.test.js @@ -15,7 +15,7 @@ describe('POST /user/allocate-now', () => { 'preferences.allocationMode': 'flat', }); - let res = await user.post(`/user/allocate-now`); + let res = await user.post('/user/allocate-now'); await user.sync(); expect(res).to.eql({ diff --git a/test/api/v3/integration/user/POST-user_buy.test.js b/test/api/v3/integration/user/POST-user_buy.test.js index af730a2c98..bca65a2ab7 100644 --- a/test/api/v3/integration/user/POST-user_buy.test.js +++ b/test/api/v3/integration/user/POST-user_buy.test.js @@ -18,7 +18,7 @@ describe('POST /user/buy/:key', () => { // More tests in common code unit tests it('returns an error if the item is not found', async () => { - await expect(user.post(`/user/buy/notExisting`)) + await expect(user.post('/user/buy/notExisting')) .to.eventually.be.rejected.and.eql({ code: 404, error: 'NotFound', @@ -28,7 +28,7 @@ describe('POST /user/buy/:key', () => { it('buys an item', async () => { let potion = content.potion; - let res = await user.post(`/user/buy/potion`); + let res = await user.post('/user/buy/potion'); await user.sync(); expect(res.data).to.eql({ diff --git a/test/api/v3/integration/user/POST-user_buy_mystery_set.test.js b/test/api/v3/integration/user/POST-user_buy_mystery_set.test.js index 0a6035a954..306f1e6677 100644 --- a/test/api/v3/integration/user/POST-user_buy_mystery_set.test.js +++ b/test/api/v3/integration/user/POST-user_buy_mystery_set.test.js @@ -15,7 +15,7 @@ describe('POST /user/buy-mystery-set/:key', () => { // More tests in common code unit tests it('returns an error if the mystery set is not found', async () => { - await expect(user.post(`/user/buy-mystery-set/notExisting`)) + await expect(user.post('/user/buy-mystery-set/notExisting')) .to.eventually.be.rejected.and.eql({ code: 404, error: 'NotFound', diff --git a/test/api/v3/integration/user/POST-user_buy_quest.test.js b/test/api/v3/integration/user/POST-user_buy_quest.test.js index 068574d977..3330988537 100644 --- a/test/api/v3/integration/user/POST-user_buy_quest.test.js +++ b/test/api/v3/integration/user/POST-user_buy_quest.test.js @@ -16,7 +16,7 @@ describe('POST /user/buy-quest/:key', () => { // More tests in common code unit tests it('returns an error if the quest is not found', async () => { - await expect(user.post(`/user/buy-quest/notExisting`)) + await expect(user.post('/user/buy-quest/notExisting')) .to.eventually.be.rejected.and.eql({ code: 404, error: 'NotFound', diff --git a/test/api/v3/integration/user/POST-user_buy_special_spell.test.js b/test/api/v3/integration/user/POST-user_buy_special_spell.test.js index 366a7f93c6..2ae16d1baf 100644 --- a/test/api/v3/integration/user/POST-user_buy_special_spell.test.js +++ b/test/api/v3/integration/user/POST-user_buy_special_spell.test.js @@ -16,7 +16,7 @@ describe('POST /user/buy-special-spell/:key', () => { // More tests in common code unit tests it('returns an error if the special spell is not found', async () => { - await expect(user.post(`/user/buy-special-spell/notExisting`)) + await expect(user.post('/user/buy-special-spell/notExisting')) .to.eventually.be.rejected.and.eql({ code: 404, error: 'NotFound', diff --git a/test/api/v3/integration/user/POST-user_change-class.test.js b/test/api/v3/integration/user/POST-user_change-class.test.js index 3ec8fe468c..a849ca9382 100644 --- a/test/api/v3/integration/user/POST-user_change-class.test.js +++ b/test/api/v3/integration/user/POST-user_change-class.test.js @@ -15,7 +15,7 @@ describe('POST /user/change-class', () => { // More tests in common code unit tests it('changes class', async () => { - let res = await user.post(`/user/change-class?class=rogue`); + let res = await user.post('/user/change-class?class=rogue'); await user.sync(); expect(res).to.eql({ diff --git a/test/api/v3/integration/user/POST-user_class_cast_spellId.test.js b/test/api/v3/integration/user/POST-user_class_cast_spellId.test.js index 0074b38b59..8ada2ede7d 100644 --- a/test/api/v3/integration/user/POST-user_class_cast_spellId.test.js +++ b/test/api/v3/integration/user/POST-user_class_cast_spellId.test.js @@ -38,7 +38,7 @@ describe('POST /user/class/cast/:spellId', () => { it('returns an error if spell.mana > user.mana', async () => { await user.update({'stats.class': 'rogue'}); - await expect(user.post(`/user/class/cast/backStab`)) + await expect(user.post('/user/class/cast/backStab')) .to.eventually.be.rejected.and.eql({ code: 401, error: 'NotAuthorized', @@ -47,7 +47,7 @@ describe('POST /user/class/cast/:spellId', () => { }); it('returns an error if spell.value > user.gold', async () => { - await expect(user.post(`/user/class/cast/birthday`)) + await expect(user.post('/user/class/cast/birthday')) .to.eventually.be.rejected.and.eql({ code: 401, error: 'NotAuthorized', @@ -57,7 +57,7 @@ describe('POST /user/class/cast/:spellId', () => { it('returns an error if spell.lvl > user.level', async () => { await user.update({'stats.mp': 200, 'stats.class': 'wizard'}); - await expect(user.post(`/user/class/cast/earth`)) + await expect(user.post('/user/class/cast/earth')) .to.eventually.be.rejected.and.eql({ code: 401, error: 'NotAuthorized', @@ -66,7 +66,7 @@ describe('POST /user/class/cast/:spellId', () => { }); it('returns an error if user doesn\'t own the spell', async () => { - await expect(user.post(`/user/class/cast/snowball`)) + await expect(user.post('/user/class/cast/snowball')) .to.eventually.be.rejected.and.eql({ code: 401, error: 'NotAuthorized', @@ -85,7 +85,7 @@ describe('POST /user/class/cast/:spellId', () => { it('returns an error if targetId is required but missing', async () => { await user.update({'stats.class': 'rogue', 'stats.lvl': 11}); - await expect(user.post(`/user/class/cast/pickPocket`)) + await expect(user.post('/user/class/cast/pickPocket')) .to.eventually.be.rejected.and.eql({ code: 400, error: 'BadRequest', @@ -153,7 +153,7 @@ describe('POST /user/class/cast/:spellId', () => { members: 1, }); await groupLeader.update({'stats.mp': 200, 'stats.class': 'wizard', 'stats.lvl': 13}); - await groupLeader.post(`/user/class/cast/earth`); + await groupLeader.post('/user/class/cast/earth'); await sleep(1); await group.sync(); expect(group.chat[0]).to.exists; diff --git a/test/api/v3/integration/user/POST-user_disable-classes.test.js b/test/api/v3/integration/user/POST-user_disable-classes.test.js index 79272e83fd..3c0a88a3ab 100644 --- a/test/api/v3/integration/user/POST-user_disable-classes.test.js +++ b/test/api/v3/integration/user/POST-user_disable-classes.test.js @@ -12,7 +12,7 @@ describe('POST /user/disable-classes', () => { // More tests in common code unit tests it('disable classes', async () => { - let res = await user.post(`/user/disable-classes`); + let res = await user.post('/user/disable-classes'); await user.sync(); expect(res).to.eql({ diff --git a/test/api/v3/integration/user/POST-user_equip_type_key.test.js b/test/api/v3/integration/user/POST-user_equip_type_key.test.js index 53e8dbfe1f..f1d697cda7 100644 --- a/test/api/v3/integration/user/POST-user_equip_type_key.test.js +++ b/test/api/v3/integration/user/POST-user_equip_type_key.test.js @@ -31,8 +31,8 @@ describe('POST /user/equip/:type/:key', () => { 'stats.gp': 200, }); - await user.post(`/user/equip/equipped/weapon_warrior_1`); - let res = await user.post(`/user/equip/equipped/weapon_warrior_2`); + await user.post('/user/equip/equipped/weapon_warrior_1'); + let res = await user.post('/user/equip/equipped/weapon_warrior_2'); await user.sync(); expect(res).to.eql({ diff --git a/test/api/v3/integration/user/POST-user_feed_pet_food.test.js b/test/api/v3/integration/user/POST-user_feed_pet_food.test.js index 6fa3275196..7581c266ee 100644 --- a/test/api/v3/integration/user/POST-user_feed_pet_food.test.js +++ b/test/api/v3/integration/user/POST-user_feed_pet_food.test.js @@ -26,7 +26,7 @@ describe('POST /user/feed/:pet/:food', () => { let potionText = content.hatchingPotions[potion] ? content.hatchingPotions[potion].text() : potion; let eggText = content.eggs[egg] ? content.eggs[egg].text() : egg; - let res = await user.post(`/user/feed/Wolf-Base/Milk`); + let res = await user.post('/user/feed/Wolf-Base/Milk'); await user.sync(); expect(res).to.eql({ data: user.items.pets['Wolf-Base'], diff --git a/test/api/v3/integration/user/POST-user_hatch_egg_hatchingPotion.test.js b/test/api/v3/integration/user/POST-user_hatch_egg_hatchingPotion.test.js index e2a5e330f5..9621377beb 100644 --- a/test/api/v3/integration/user/POST-user_hatch_egg_hatchingPotion.test.js +++ b/test/api/v3/integration/user/POST-user_hatch_egg_hatchingPotion.test.js @@ -17,7 +17,7 @@ describe('POST /user/hatch/:egg/:hatchingPotion', () => { 'items.eggs.Wolf': 1, 'items.hatchingPotions.Base': 1, }); - let res = await user.post(`/user/hatch/Wolf/Base`); + let res = await user.post('/user/hatch/Wolf/Base'); await user.sync(); expect(user.items.pets['Wolf-Base']).to.equal(5); expect(user.items.eggs.Wolf).to.equal(0); diff --git a/test/api/v3/integration/user/POST-user_open_mystery_item.test.js b/test/api/v3/integration/user/POST-user_open_mystery_item.test.js index 2c43445118..d9e9fe7326 100644 --- a/test/api/v3/integration/user/POST-user_open_mystery_item.test.js +++ b/test/api/v3/integration/user/POST-user_open_mystery_item.test.js @@ -16,7 +16,7 @@ describe('POST /user/open-mystery-item', () => { // More tests in common code unit tests it('opens a mystery item', async () => { - let response = await user.post(`/user/open-mystery-item`); + let response = await user.post('/user/open-mystery-item'); await user.sync(); expect(user.items.gear.owned[mysteryItemKey]).to.be.true; diff --git a/test/api/v3/integration/user/POST-user_purchase.test.js b/test/api/v3/integration/user/POST-user_purchase.test.js index 6afaa14cb6..9c2963112b 100644 --- a/test/api/v3/integration/user/POST-user_purchase.test.js +++ b/test/api/v3/integration/user/POST-user_purchase.test.js @@ -17,7 +17,7 @@ describe('POST /user/purchase/:type/:key', () => { // More tests in common code unit tests it('returns an error when key is not provided', async () => { - await expect(user.post(`/user/purchase/gems/gem`)) + await expect(user.post('/user/purchase/gems/gem')) .to.eventually.be.rejected.and.eql({ code: 401, error: 'NotAuthorized', diff --git a/test/api/v3/integration/user/POST-user_sleep.test.js b/test/api/v3/integration/user/POST-user_sleep.test.js index eb4a38b8bb..da95ae97b0 100644 --- a/test/api/v3/integration/user/POST-user_sleep.test.js +++ b/test/api/v3/integration/user/POST-user_sleep.test.js @@ -12,14 +12,14 @@ describe('POST /user/sleep', () => { // More tests in common code unit tests it('toggles sleep status', async () => { - let res = await user.post(`/user/sleep`); + let res = await user.post('/user/sleep'); expect(res).to.eql({ preferences: {sleep: true}, }); await user.sync(); expect(user.preferences.sleep).to.be.true; - let res2 = await user.post(`/user/sleep`); + let res2 = await user.post('/user/sleep'); expect(res2).to.eql({ preferences: {sleep: false}, }); diff --git a/test/api/v3/integration/user/PUT-user.test.js b/test/api/v3/integration/user/PUT-user.test.js index eb623e0a4a..f606c95c2c 100644 --- a/test/api/v3/integration/user/PUT-user.test.js +++ b/test/api/v3/integration/user/PUT-user.test.js @@ -108,7 +108,7 @@ describe('PUT /user', () => { })).to.eventually.be.rejected.and.eql({ code: 401, error: 'NotAuthorized', - message: t(`mustPurchaseToSet`, { val: 'round', key: 'preferences.size' }), + message: t('mustPurchaseToSet', { val: 'round', key: 'preferences.size' }), }); }); diff --git a/website/src/controllers/api-v2/coupon.js b/website/src/controllers/api-v2/coupon.js index dd1b6c189d..17cd289bd3 100644 --- a/website/src/controllers/api-v2/coupon.js +++ b/website/src/controllers/api-v2/coupon.js @@ -30,7 +30,7 @@ api.getCoupons = function(req,res,next) { res.set({ 'Content-Type': 'text/csv', - 'Content-disposition': `attachment; filename=habitica-coupons.csv`, + 'Content-disposition': 'attachment; filename=habitica-coupons.csv', }); csvStringify(output, (err, csv) => { if (err) return next(err); diff --git a/website/src/controllers/api-v2/dataexport.js b/website/src/controllers/api-v2/dataexport.js index 2b3c46ed31..f0aad2b35c 100644 --- a/website/src/controllers/api-v2/dataexport.js +++ b/website/src/controllers/api-v2/dataexport.js @@ -44,7 +44,7 @@ dataexport.history = function(req, res) { res.set({ 'Content-Type': 'text/csv', - 'Content-disposition': `attachment; filename=habitica-tasks-history.csv`, + 'Content-disposition': 'attachment; filename=habitica-tasks-history.csv', }); csvStringify(output, (err, csv) => { diff --git a/website/src/controllers/api-v3/chat.js b/website/src/controllers/api-v3/chat.js index 65f4b298c1..24e4ea8bab 100644 --- a/website/src/controllers/api-v3/chat.js +++ b/website/src/controllers/api-v3/chat.js @@ -224,7 +224,7 @@ api.flagChat = { if (group._id === TAVERN_ID) { groupUrl = '/#/options/groups/tavern'; } else if (group.type === 'guild') { - groupUrl = `/#/options/groups/guilds/{$group._id}`; + groupUrl = `/#/options/groups/guilds/${group._id}`; } else { groupUrl = 'party'; } @@ -236,12 +236,12 @@ api.flagChat = { {name: 'REPORTER_USERNAME', content: user.profile.name}, {name: 'REPORTER_UUID', content: user._id}, {name: 'REPORTER_EMAIL', content: reporterEmailContent}, - {name: 'REPORTER_MODAL_URL', content: `/static/front/#?memberId={$user._id}`}, + {name: 'REPORTER_MODAL_URL', content: `/static/front/#?memberId=${user._id}`}, {name: 'AUTHOR_USERNAME', content: message.user}, {name: 'AUTHOR_UUID', content: message.uuid}, {name: 'AUTHOR_EMAIL', content: authorEmailContent}, - {name: 'AUTHOR_MODAL_URL', content: `/static/front/#?memberId={$message.uuid}`}, + {name: 'AUTHOR_MODAL_URL', content: `/static/front/#?memberId=${message.uuid}`}, {name: 'GROUP_NAME', content: group.name}, {name: 'GROUP_TYPE', content: group.type}, diff --git a/website/src/controllers/api-v3/coupon.js b/website/src/controllers/api-v3/coupon.js index 8fee188094..8ecae368ee 100644 --- a/website/src/controllers/api-v3/coupon.js +++ b/website/src/controllers/api-v3/coupon.js @@ -32,7 +32,7 @@ api.getCoupons = { res.set({ 'Content-Type': 'text/csv', - 'Content-disposition': `attachment; filename=habitica-coupons.csv`, + 'Content-disposition': 'attachment; filename=habitica-coupons.csv', }); res.status(200).send(csv); }, diff --git a/website/src/controllers/api-v3/user.js b/website/src/controllers/api-v3/user.js index d743c9e9a8..f0d4b8d925 100644 --- a/website/src/controllers/api-v3/user.js +++ b/website/src/controllers/api-v3/user.js @@ -159,7 +159,7 @@ api.updateUser = { let purchasable = requiresPurchase[key]; if (purchasable && !checkPreferencePurchase(user, purchasable, val)) { - throw new NotAuthorized(res.t(`mustPurchaseToSet`, { val, key })); + throw new NotAuthorized(res.t('mustPurchaseToSet', { val, key })); } if (acceptablePUTPaths[key]) { diff --git a/website/src/controllers/top-level/dataexport.js b/website/src/controllers/top-level/dataexport.js index 6924c9b89f..f76e11421c 100644 --- a/website/src/controllers/top-level/dataexport.js +++ b/website/src/controllers/top-level/dataexport.js @@ -64,7 +64,7 @@ api.exportUserHistory = { res.set({ 'Content-Type': 'text/csv', - 'Content-disposition': `attachment; filename=habitica-tasks-history.csv`, + 'Content-disposition': 'attachment; filename=habitica-tasks-history.csv', }); let csvRes = await csvStringify(output); @@ -111,7 +111,7 @@ api.exportUserDataJson = { res.set({ 'Content-Type': 'application/json', - 'Content-disposition': `attachment; filename=habitica-user-data.json`, + 'Content-disposition': 'attachment; filename=habitica-user-data.json', }); let jsonRes = JSON.stringify(userData); @@ -137,7 +137,7 @@ api.exportUserDataXml = { res.set({ 'Content-Type': 'text/xml', - 'Content-disposition': `attachment; filename=habitica-user-data.xml`, + 'Content-disposition': 'attachment; filename=habitica-user-data.xml', }); res.status(200).send(js2xml('user', userData)); }, diff --git a/website/src/controllers/top-level/pages.js b/website/src/controllers/top-level/pages.js index 0d1800ee16..058408d263 100644 --- a/website/src/controllers/top-level/pages.js +++ b/website/src/controllers/top-level/pages.js @@ -39,8 +39,8 @@ _.each(staticPages, (name) => { async handler (req, res) { res.render(`static/${name}.jade`, { env: res.locals.habitrpg, - marked: marked, - userCount: TOTAL_USER_COUNT + marked, + userCount: TOTAL_USER_COUNT, }); }, }; @@ -57,8 +57,8 @@ _.each(shareables, (name) => { async handler (req, res) { res.render(`social/${name}`, { env: res.locals.habitrpg, - marked: marked, - userCount: TOTAL_USER_COUNT + marked, + userCount: TOTAL_USER_COUNT, }); }, }; diff --git a/website/src/index.js b/website/src/index.js index 24dbc21384..1b133ca781 100644 --- a/website/src/index.js +++ b/website/src/index.js @@ -1,4 +1,5 @@ 'use strict'; +/* eslint-disable global-require, no-process-env */ // Register babel hook so we can write the real entry file (server.js) in ES6 // In production, the es6 code is pre-transpiled so it doesn't need it diff --git a/website/src/models/group.js b/website/src/models/group.js index b3c25ae913..a5a43a10ce 100644 --- a/website/src/models/group.js +++ b/website/src/models/group.js @@ -161,10 +161,11 @@ schema.statics.getGroups = async function getGroups (options = {}) { types.forEach(type => { switch (type) { - case 'party': + case 'party': { queries.push(this.getGroup({user, groupId: 'party', fields: groupFields, populateLeader})); break; - case 'privateGuilds': + } + case 'privateGuilds': { let privateGroupQuery = this.find({ type: 'guild', privacy: 'private', @@ -174,7 +175,8 @@ schema.statics.getGroups = async function getGroups (options = {}) { privateGroupQuery.sort(sort).exec(); queries.push(privateGroupQuery); break; - case 'publicGuilds': + } + case 'publicGuilds': { let publicGroupQuery = this.find({ type: 'guild', privacy: 'public', @@ -183,11 +185,13 @@ schema.statics.getGroups = async function getGroups (options = {}) { publicGroupQuery.sort(sort).exec(); queries.push(publicGroupQuery); // TODO use lean? break; - case 'tavern': + } + case 'tavern': { if (types.indexOf('publicGuilds') === -1) { queries.push(this.getGroup({user, groupId: TAVERN_ID, fields: groupFields})); } break; + } } }); @@ -436,22 +440,26 @@ schema.methods.finishQuest = function finishQuest (quest) { let dropK = item.key; switch (item.type) { - case 'gear': + case 'gear': { // TODO This means they can lose their new gear on death, is that what we want? updates.$set[`items.gear.owned.${dropK}`] = true; break; + } case 'eggs': case 'food': case 'hatchingPotions': - case 'quests': + case 'quests': { updates.$inc[`items.${item.type}.${dropK}`] = _.where(quest.drop.items, {type: item.type, key: item.key}).length; break; - case 'pets': + } + case 'pets': { updates.$set[`items.pets.${dropK}`] = 5; break; - case 'mounts': + } + case 'mounts': { updates.$set[`items.mounts.${dropK}`] = true; break; + } } }); diff --git a/website/src/models/user.js b/website/src/models/user.js index fcf0078cf4..76c730ec26 100644 --- a/website/src/models/user.js +++ b/website/src/models/user.js @@ -549,7 +549,7 @@ export let publicFields = `preferences.size preferences.hair preferences.skin pr backer contributor auth.timestamps items`; // The minimum amount of data needed when populating multiple users -export let nameFields = `profile.name`; +export let nameFields = 'profile.name'; schema.post('init', function postInitUser (doc) { shared.wrap(doc);