Compare commits

..

8 Commits

Author SHA1 Message Date
Sabe Jones 79c1a5d9c1 4.166.0 2020-10-20 14:12:23 -05:00
Sabe Jones 8b955e2c5e feat(content): Skeleton Achievements 2020-10-19 15:38:12 -05:00
Matteo Pagliazzi 67c607216f 4.165.3 2020-10-19 16:54:20 +02:00
Matteo Pagliazzi 672fd43ad0 user dropdown: restore backgrounds 2020-10-19 16:54:15 +02:00
Matteo Pagliazzi 69281f80ea drop cap ab test: misc fixes (#12694) 2020-10-19 16:53:28 +02:00
Matteo Pagliazzi ec0e5024a7 new users: do not show bailey news (#12693) 2020-10-19 12:30:41 +02:00
Matteo Pagliazzi 8e6ce39d64 4.165.2 2020-10-19 01:11:20 +02:00
Matteo Pagliazzi 617832f02d fix(i18n): restore missing strings 2020-10-19 01:11:00 +02:00
24 changed files with 351 additions and 139 deletions
@@ -0,0 +1,82 @@
/* eslint-disable no-console */
const MIGRATION_NAME = '20201020_pet_color_achievements';
import { model as User } from '../../../website/server/models/user';
const progressCount = 1000;
let count = 0;
async function updateUser (user) {
count++;
const set = {
migration: MIGRATION_NAME,
};
if (user && user.items && user.items.pets) {
const pets = user.items.pets;
if (pets['Wolf-Golden'] > 0
&& pets['TigerCub-Skeleton'] > 0
&& pets['PandaCub-Skeleton'] > 0
&& pets['LionCub-Skeleton'] > 0
&& pets['Fox-Skeleton'] > 0
&& pets['FlyingPig-Skeleton'] > 0
&& pets['Dragon-Skeleton'] > 0
&& pets['Cactus-Skeleton'] > 0
&& pets['BearCub-Skeleton'] > 0) {
set['achievements.boneCollector'] = true;
}
}
if (user && user.items && user.items.mounts) {
const mounts = user.items.mounts;
if (mounts['Wolf-Skeleton']
&& mounts['TigerCub-Skeleton']
&& mounts['PandaCub-Skeleton']
&& mounts['LionCub-Skeleton']
&& mounts['Fox-Skeleton']
&& mounts['FlyingPig-Skeleton']
&& mounts['Dragon-Skeleton']
&& mounts['Cactus-Skeleton']
&& mounts['BearCub-Skeleton'] ) {
set['achievements.skeletonCrew'] = true;
}
}
if (count % progressCount === 0) console.warn(`${count} ${user._id}`);
return await User.update({ _id: user._id }, { $set: set }).exec();
}
module.exports = async function processUsers () {
let query = {
migration: { $ne: MIGRATION_NAME },
'auth.timestamps.loggedin': { $gt: new Date('2020-10-01') },
};
const fields = {
_id: 1,
items: 1,
};
while (true) { // eslint-disable-line no-constant-condition
const users = await User // eslint-disable-line no-await-in-loop
.find(query)
.limit(250)
.sort({_id: 1})
.select(fields)
.lean()
.exec();
if (users.length === 0) {
console.warn('All appropriate users found and modified.');
console.warn(`\n${count} users processed\n`);
break;
} else {
query._id = {
$gt: users[users.length - 1]._id,
};
}
await Promise.all(users.map(updateUser)); // eslint-disable-line no-await-in-loop
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "habitica",
"version": "4.165.1",
"version": "4.166.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "habitica",
"description": "A habit tracker app which treats your goals like a Role Playing Game.",
"version": "4.165.1",
"version": "4.166.0",
"main": "./website/server/index.js",
"dependencies": {
"@babel/core": "^7.11.6",
+44
View File
@@ -592,6 +592,50 @@ describe('User Model', () => {
});
context('pre-save hook', () => {
it('enrolls users that signup through web in the Drop Cap AB test', async () => {
let user = new User();
user.registeredThrough = 'habitica-web';
user = await user.save();
expect(user._ABtests.dropCapNotif).to.exist;
});
it('does not enroll users that signup through modal in the Drop Cap AB test', async () => {
let user = new User();
user.registeredThrough = 'habitica-ios';
user = await user.save();
expect(user._ABtests.dropCapNotif).to.not.exist;
});
it('marks the last news post as read for new users', async () => {
const lastNewsPost = { _id: '1' };
sandbox.stub(NewsPost, 'lastNewsPost').returns(lastNewsPost);
let user = new User();
expect(user.isNew).to.equal(true);
user = await user.save();
expect(user.checkNewStuff()).to.equal(false);
expect(user.toJSON().flags.newStuff).to.equal(false);
expect(user.flags.lastNewStuffRead).to.equal(lastNewsPost._id);
});
it('does not mark the last news post as read for existing users', async () => {
const lastNewsPost = { _id: '1' };
const lastNewsPostStub = sandbox.stub(NewsPost, 'lastNewsPost');
lastNewsPostStub.returns(lastNewsPost);
let user = new User();
user = await user.save();
expect(user.isNew).to.equal(false);
user.profile.name = 'new name';
lastNewsPostStub.returns({ _id: '2' });
user = await user.save();
expect(user.flags.lastNewStuffRead).to.equal(lastNewsPost._id); // not _id: 2
});
it('does not try to award achievements when achievements or items not selected in query', async () => {
let user = new User();
user = await user.save(); // necessary for user.isSelected to work correctly
@@ -1,60 +1,66 @@
.promo_armoire_backgrounds_202010 {
background-image: url('~@/assets/images/sprites/spritesmith-largeSprites-0.png');
background-position: 0px -452px;
background-position: 0px -639px;
width: 423px;
height: 147px;
}
.promo_fall_customizations {
background-image: url('~@/assets/images/sprites/spritesmith-largeSprites-0.png');
background-position: 0px -244px;
background-position: -532px 0px;
width: 336px;
height: 207px;
}
.promo_fall_festival_2019 {
background-image: url('~@/assets/images/sprites/spritesmith-largeSprites-0.png');
background-position: -532px 0px;
background-position: 0px -449px;
width: 360px;
height: 189px;
}
.promo_fall_festival_2020 {
background-image: url('~@/assets/images/sprites/spritesmith-largeSprites-0.png');
background-position: -532px -190px;
background-position: -361px -449px;
width: 360px;
height: 174px;
}
.promo_mystery_202009 {
background-image: url('~@/assets/images/sprites/spritesmith-largeSprites-0.png');
background-position: -893px 0px;
background-position: -869px -296px;
width: 282px;
height: 147px;
}
.promo_mystery_202010 {
background-image: url('~@/assets/images/sprites/spritesmith-largeSprites-0.png');
background-position: -893px -148px;
background-position: -869px -444px;
width: 282px;
height: 147px;
}
.promo_sandy_sidekicks_bundle {
background-image: url('~@/assets/images/sprites/spritesmith-largeSprites-0.png');
background-position: -424px -600px;
background-position: -869px -148px;
width: 420px;
height: 147px;
}
.promo_skeleton_achievements {
background-image: url('~@/assets/images/sprites/spritesmith-largeSprites-0.png');
background-position: 0px -244px;
width: 366px;
height: 204px;
}
.promo_spooky_sparkles {
background-image: url('~@/assets/images/sprites/spritesmith-largeSprites-0.png');
background-position: -424px -452px;
background-position: -424px -639px;
width: 423px;
height: 147px;
}
.promo_take_this {
background-image: url('~@/assets/images/sprites/spritesmith-largeSprites-0.png');
background-position: -1035px -426px;
background-position: -1152px -296px;
width: 96px;
height: 69px;
}
.promo_vampire_potions {
background-image: url('~@/assets/images/sprites/spritesmith-largeSprites-0.png');
background-position: 0px -600px;
background-position: -869px 0px;
width: 423px;
height: 147px;
}
@@ -66,13 +72,13 @@
}
.scene_squall {
background-image: url('~@/assets/images/sprites/spritesmith-largeSprites-0.png');
background-position: -893px -426px;
background-position: -532px -208px;
width: 141px;
height: 169px;
}
.scene_strength {
background-image: url('~@/assets/images/sprites/spritesmith-largeSprites-0.png');
background-position: -893px -296px;
background-position: -869px -592px;
width: 192px;
height: 129px;
}
@@ -1,12 +1,12 @@
.achievement-alien {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1671px -1480px;
background-position: -1568px -1628px;
width: 24px;
height: 26px;
}
.achievement-alien2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -524px -1549px;
background-position: -622px -1549px;
width: 48px;
height: 52px;
}
@@ -24,7 +24,7 @@
}
.achievement-alpha2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -573px -1549px;
background-position: -671px -1549px;
width: 48px;
height: 52px;
}
@@ -36,13 +36,13 @@
}
.achievement-armor2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -622px -1549px;
background-position: -720px -1549px;
width: 48px;
height: 52px;
}
.achievement-backToBasics2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1279px -1480px;
background-position: -1344px -1480px;
width: 48px;
height: 56px;
}
@@ -54,25 +54,31 @@
}
.achievement-bewilder2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -671px -1549px;
background-position: -769px -1549px;
width: 48px;
height: 52px;
}
.achievement-birthday2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -720px -1549px;
background-position: -818px -1549px;
width: 48px;
height: 52px;
}
.achievement-boneCollector2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1393px -1480px;
width: 48px;
height: 56px;
}
.achievement-boot2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -769px -1549px;
background-position: -867px -1549px;
width: 48px;
height: 52px;
}
.achievement-bow2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -818px -1549px;
background-position: -916px -1549px;
width: 48px;
height: 52px;
}
@@ -84,85 +90,85 @@
}
.achievement-burnout2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -867px -1549px;
background-position: -965px -1549px;
width: 48px;
height: 52px;
}
.achievement-cactus2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -916px -1549px;
background-position: -1014px -1549px;
width: 48px;
height: 52px;
}
.achievement-cake2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -965px -1549px;
background-position: -1063px -1549px;
width: 48px;
height: 52px;
}
.achievement-cave2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1014px -1549px;
background-position: -1112px -1549px;
width: 48px;
height: 52px;
}
.achievement-challenge2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1063px -1549px;
background-position: -1161px -1549px;
width: 48px;
height: 52px;
}
.achievement-comment2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1112px -1549px;
background-position: -1210px -1549px;
width: 48px;
height: 52px;
}
.achievement-completedTask2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1328px -1480px;
background-position: -1442px -1480px;
width: 48px;
height: 56px;
}
.achievement-congrats2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1161px -1549px;
background-position: -1259px -1549px;
width: 48px;
height: 52px;
}
.achievement-costumeContest2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1210px -1549px;
background-position: -1308px -1549px;
width: 48px;
height: 52px;
}
.achievement-createdTask2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1377px -1480px;
background-position: -1491px -1480px;
width: 48px;
height: 56px;
}
.achievement-dilatory2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1259px -1549px;
background-position: -1357px -1549px;
width: 48px;
height: 52px;
}
.achievement-dustDevil2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1426px -1480px;
background-position: -1540px -1480px;
width: 48px;
height: 56px;
}
.achievement-dysheartener2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1308px -1549px;
background-position: -1406px -1549px;
width: 48px;
height: 52px;
}
.achievement-fedPet2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1475px -1480px;
background-position: -1589px -1480px;
width: 48px;
height: 56px;
}
@@ -174,61 +180,61 @@
}
.achievement-friends2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1357px -1549px;
background-position: -1455px -1549px;
width: 48px;
height: 52px;
}
.achievement-getwell2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1406px -1549px;
background-position: -1504px -1549px;
width: 48px;
height: 52px;
}
.achievement-goodAsGold2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1524px -1480px;
background-position: -1638px -1480px;
width: 48px;
height: 56px;
}
.achievement-goodluck2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1455px -1549px;
background-position: -1553px -1549px;
width: 48px;
height: 52px;
}
.achievement-greeting2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1504px -1549px;
background-position: -1602px -1549px;
width: 48px;
height: 52px;
}
.achievement-guild2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1553px -1549px;
background-position: -1651px -1549px;
width: 48px;
height: 52px;
}
.achievement-habitBirthday2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1602px -1549px;
background-position: 0px -1628px;
width: 48px;
height: 52px;
}
.achievement-habiticaDay2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1651px -1549px;
background-position: -49px -1628px;
width: 48px;
height: 52px;
}
.achievement-hatchedPet2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1573px -1480px;
background-position: -426px -1549px;
width: 48px;
height: 56px;
}
.achievement-heart2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: 0px -1628px;
background-position: -98px -1628px;
width: 48px;
height: 52px;
}
@@ -240,13 +246,13 @@
}
.achievement-karaoke-2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -49px -1628px;
background-position: -147px -1628px;
width: 48px;
height: 52px;
}
.achievement-karaoke {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1671px -1507px;
background-position: -1593px -1628px;
width: 24px;
height: 26px;
}
@@ -258,7 +264,7 @@
}
.achievement-lostMasterclasser2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -98px -1628px;
background-position: -196px -1628px;
width: 48px;
height: 52px;
}
@@ -270,37 +276,37 @@
}
.achievement-monsterMagus2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1622px -1480px;
background-position: -475px -1549px;
width: 48px;
height: 56px;
}
.achievement-ninja2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -147px -1628px;
background-position: -245px -1628px;
width: 48px;
height: 52px;
}
.achievement-npc2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -196px -1628px;
background-position: -294px -1628px;
width: 48px;
height: 52px;
}
.achievement-nye2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -245px -1628px;
background-position: -343px -1628px;
width: 48px;
height: 52px;
}
.achievement-partyOn2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -294px -1628px;
background-position: -392px -1628px;
width: 48px;
height: 52px;
}
.achievement-partyUp2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -343px -1628px;
background-position: -441px -1628px;
width: 48px;
height: 52px;
}
@@ -312,25 +318,25 @@
}
.achievement-perfect2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -392px -1628px;
background-position: -490px -1628px;
width: 48px;
height: 52px;
}
.achievement-primedForPainting2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -426px -1549px;
background-position: -524px -1549px;
width: 48px;
height: 56px;
}
.achievement-purchasedEquipment2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -475px -1549px;
background-position: -573px -1549px;
width: 48px;
height: 56px;
}
.achievement-rat2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -441px -1628px;
background-position: -539px -1628px;
width: 48px;
height: 52px;
}
@@ -342,70 +348,76 @@
}
.achievement-royally-loyal2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -490px -1628px;
background-position: -588px -1628px;
width: 48px;
height: 52px;
}
.achievement-seafoam2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -539px -1628px;
background-position: -637px -1628px;
width: 48px;
height: 52px;
}
.achievement-shield2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -588px -1628px;
background-position: -686px -1628px;
width: 48px;
height: 52px;
}
.achievement-shinySeed2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -637px -1628px;
width: 48px;
height: 52px;
}
.achievement-snowball2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -686px -1628px;
width: 48px;
height: 52px;
}
.achievement-spookySparkles2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -735px -1628px;
width: 48px;
height: 52px;
}
.achievement-stoikalm2x {
.achievement-skeletonCrew2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1214px -1480px;
width: 64px;
height: 56px;
}
.achievement-snowball2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -784px -1628px;
width: 48px;
height: 52px;
}
.achievement-sun2x {
.achievement-spookySparkles2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -833px -1628px;
width: 48px;
height: 52px;
}
.achievement-sword2x {
.achievement-stoikalm2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -882px -1628px;
width: 48px;
height: 52px;
}
.achievement-thankyou2x {
.achievement-sun2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -931px -1628px;
width: 48px;
height: 52px;
}
.achievement-thermometer2x {
.achievement-sword2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -980px -1628px;
width: 48px;
height: 52px;
}
.achievement-thankyou2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1029px -1628px;
width: 48px;
height: 52px;
}
.achievement-thermometer2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1078px -1628px;
width: 48px;
height: 52px;
}
.achievement-tickledPink2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -702px -1480px;
@@ -414,61 +426,61 @@
}
.achievement-tree2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1029px -1628px;
background-position: -1127px -1628px;
width: 48px;
height: 52px;
}
.achievement-triadbingo2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1078px -1628px;
background-position: -1176px -1628px;
width: 48px;
height: 52px;
}
.achievement-ultimate-healer2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1127px -1628px;
background-position: -1225px -1628px;
width: 48px;
height: 52px;
}
.achievement-ultimate-mage2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1176px -1628px;
background-position: -1274px -1628px;
width: 48px;
height: 52px;
}
.achievement-ultimate-rogue2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1225px -1628px;
background-position: -1323px -1628px;
width: 48px;
height: 52px;
}
.achievement-ultimate-warrior2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1274px -1628px;
background-position: -1372px -1628px;
width: 48px;
height: 52px;
}
.achievement-undeadUndertaker2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1214px -1480px;
background-position: -1279px -1480px;
width: 64px;
height: 56px;
}
.achievement-unearned2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1323px -1628px;
background-position: -1421px -1628px;
width: 48px;
height: 52px;
}
.achievement-valentine2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1372px -1628px;
background-position: -1470px -1628px;
width: 48px;
height: 52px;
}
.achievement-wolf2x {
background-image: url('~@/assets/images/sprites/spritesmith-main-0.png');
background-position: -1421px -1628px;
background-position: -1519px -1628px;
width: 48px;
height: 52px;
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 466 KiB

After

Width:  |  Height:  |  Size: 466 KiB

@@ -3,7 +3,7 @@
id="drop-cap-reached"
size="md"
:hide-header="true"
:hide-footer="!hasSubscription"
:hide-footer="hasSubscription"
>
<div class="text-center">
<div
@@ -235,15 +235,15 @@ export default {
});
},
toLearnMore () {
this.close();
this.$router.push('/user/settings/subscription');
Analytics.track({
hitType: 'event',
eventCategory: 'drop-cap-reached',
eventAction: 'click',
eventLabel: 'Drop Cap Reached > Modal > Subscriptions',
});
this.close();
this.$router.push('/user/settings/subscription');
},
},
};
@@ -38,6 +38,10 @@
class="topbar-dropdown-item dropdown-item"
@click="showAvatar('body', 'size')"
>{{ $t('editAvatar') }}</a>
<a
class="topbar-dropdown-item dropdown-item dropdown-separated"
@click="showAvatar('backgrounds', '2020')"
>{{ $t('backgrounds') }}</a>
<a
class="topbar-dropdown-item dropdown-item"
@click="showProfile('profile')"
@@ -94,7 +98,7 @@
<button
v-once
class="btn btn-primary mb-4"
@click="$router.push({name: 'subscription'})"
@click="toLearnMore()"
>
{{ $t('learnMore') }}
</button>
@@ -173,15 +177,15 @@ export default {
showProfile (startingPage) {
this.$router.push({ name: startingPage });
},
showBuyGemsModal () {
toLearnMore () {
Analytics.track({
hitType: 'event',
eventCategory: 'button',
eventAction: 'click',
eventLabel: 'Gems > User Dropdown',
eventLabel: 'User Dropdown > Subscriptions',
});
this.$root.$emit('bv::show::modal', 'buy-gems', { alreadyTracked: true });
this.$router.push({ name: 'subscription' });
},
logout () {
this.$store.dispatch('auth:logout');
+38 -19
View File
@@ -188,7 +188,7 @@ const NOTIFICATIONS = {
label: $t => `${$t('achievement')}: ${$t('achievementBackToBasics')}`,
modalId: 'generic-achievement',
data: {
achievement: 'backToBasics', // defined manually until the server sends all the necessary data
achievement: 'backToBasics',
},
},
ACHIEVEMENT_DUST_DEVIL: {
@@ -196,7 +196,7 @@ const NOTIFICATIONS = {
label: $t => `${$t('achievement')}: ${$t('achievementDustDevil')}`,
modalId: 'generic-achievement',
data: {
achievement: 'dustDevil', // defined manually until the server sends all the necessary data
achievement: 'dustDevil',
},
},
ACHIEVEMENT_ARID_AUTHORITY: {
@@ -204,7 +204,7 @@ const NOTIFICATIONS = {
label: $t => `${$t('achievement')}: ${$t('achievementAridAuthority')}`,
modalId: 'generic-achievement',
data: {
achievement: 'aridAuthority', // defined manually until the server sends all the necessary data
achievement: 'aridAuthority',
},
},
ACHIEVEMENT_PARTY_UP: {
@@ -214,7 +214,7 @@ const NOTIFICATIONS = {
data: {
message: $t => $t('achievement'),
modalText: $t => $t('achievementPartyUp'),
achievement: 'partyUp', // defined manually until the server sends all the necessary data
achievement: 'partyUp',
},
},
ACHIEVEMENT_PARTY_ON: {
@@ -224,7 +224,7 @@ const NOTIFICATIONS = {
data: {
message: $t => $t('achievement'),
modalText: $t => $t('achievementPartyOn'),
achievement: 'partyOn', // defined manually until the server sends all the necessary data
achievement: 'partyOn',
},
},
ACHIEVEMENT_BEAST_MASTER: {
@@ -234,7 +234,7 @@ const NOTIFICATIONS = {
data: {
message: $t => $t('achievement'),
modalText: $t => $t('beastAchievement'),
achievement: 'beastMaster', // defined manually until the server sends all the necessary data
achievement: 'beastMaster',
},
},
ACHIEVEMENT_MOUNT_MASTER: {
@@ -244,7 +244,7 @@ const NOTIFICATIONS = {
data: {
message: $t => $t('achievement'),
modalText: $t => $t('mountAchievement'),
achievement: 'mountMaster', // defined manually until the server sends all the necessary data
achievement: 'mountMaster',
},
},
ACHIEVEMENT_TRIAD_BINGO: {
@@ -254,7 +254,7 @@ const NOTIFICATIONS = {
data: {
message: $t => $t('achievement'),
modalText: $t => $t('triadBingoAchievement'),
achievement: 'triadBingo', // defined manually until the server sends all the necessary data
achievement: 'triadBingo',
},
},
ACHIEVEMENT_MONSTER_MAGUS: {
@@ -262,7 +262,7 @@ const NOTIFICATIONS = {
label: $t => `${$t('achievement')}: ${$t('achievementMonsterMagus')}`,
modalId: 'generic-achievement',
data: {
achievement: 'monsterMagus', // defined manually until the server sends all the necessary data
achievement: 'monsterMagus',
},
},
ACHIEVEMENT_UNDEAD_UNDERTAKER: {
@@ -270,7 +270,7 @@ const NOTIFICATIONS = {
label: $t => `${$t('achievement')}: ${$t('achievementUndeadUndertaker')}`,
modalId: 'generic-achievement',
data: {
achievement: 'undeadUndertaker', // defined manually until the server sends all the necessary data
achievement: 'undeadUndertaker',
},
},
ACHIEVEMENT: { // data filled in handleUserNotifications
@@ -287,7 +287,7 @@ const NOTIFICATIONS = {
label: $t => `${$t('achievement')}: ${$t('achievementPrimedForPainting')}`,
modalId: 'generic-achievement',
data: {
achievement: 'primedForPainting', // defined manually until the server sends all the necessary data
achievement: 'primedForPainting',
},
},
ACHIEVEMENT_PEARLY_PRO: {
@@ -295,7 +295,7 @@ const NOTIFICATIONS = {
label: $t => `${$t('achievement')}: ${$t('achievementPearlyPro')}`,
modalId: 'generic-achievement',
data: {
achievement: 'pearlyPro', // defined manually until the server sends all the necessary data
achievement: 'pearlyPro',
},
},
ACHIEVEMENT_TICKLED_PINK: {
@@ -303,7 +303,7 @@ const NOTIFICATIONS = {
label: $t => `${$t('achievement')}: ${$t('achievementTickledPink')}`,
modalId: 'generic-achievement',
data: {
achievement: 'tickledPink', // defined manually until the server sends all the necessary data
achievement: 'tickledPink',
},
},
ACHIEVEMENT_ROSY_OUTLOOK: {
@@ -311,7 +311,7 @@ const NOTIFICATIONS = {
label: $t => `${$t('achievement')}: ${$t('achievementRosyOutlook')}`,
modalId: 'generic-achievement',
data: {
achievement: 'rosyOutlook', // defined manually until the server sends all the necessary data
achievement: 'rosyOutlook',
},
},
ACHIEVEMENT_BUG_BONANZA: {
@@ -319,7 +319,7 @@ const NOTIFICATIONS = {
label: $t => `${$t('achievement')}: ${$t('achievementBugBonanza')}`,
modalId: 'generic-achievement',
data: {
achievement: 'bugBonanza', // defined manually until the server sends all the necessary data
achievement: 'bugBonanza',
},
},
ACHIEVEMENT_BARE_NECESSITIES: {
@@ -327,7 +327,7 @@ const NOTIFICATIONS = {
label: $t => `${$t('achievement')}: ${$t('achievementBareNecessities')}`,
modalId: 'generic-achievement',
data: {
achievement: 'bareNecessities', // defined manually until the server sends all the necessary data
achievement: 'bareNecessities',
},
},
ACHIEVEMENT_FRESHWATER_FRIENDS: {
@@ -335,7 +335,7 @@ const NOTIFICATIONS = {
label: $t => `${$t('achievement')}: ${$t('achievementFreshwaterFriends')}`,
modalId: 'generic-achievement',
data: {
achievement: 'freshwaterFriends', // defined manually until the server sends all the necessary data
achievement: 'freshwaterFriends',
},
},
ACHIEVEMENT_GOOD_AS_GOLD: {
@@ -343,7 +343,7 @@ const NOTIFICATIONS = {
label: $t => `${$t('achievement')}: ${$t('achievementGoodAsGold')}`,
modalId: 'generic-achievement',
data: {
achievement: 'goodAsGold', // defined manually until the server sends all the necessary data
achievement: 'goodAsGold',
},
},
ACHIEVEMENT_ALL_THAT_GLITTERS: {
@@ -351,7 +351,23 @@ const NOTIFICATIONS = {
label: $t => `${$t('achievement')}: ${$t('achievementAllThatGlitters')}`,
modalId: 'generic-achievement',
data: {
achievement: 'allThatGlitters', // defined manually until the server sends all the necessary data
achievement: 'allThatGlitters',
},
},
ACHIEVEMENT_BONE_COLLECTOR: {
achievement: true,
label: $t => `${$t('achievement')}: ${$t('achievementBoneCollector')}`,
modalId: 'generic-achievement',
data: {
achievement: 'boneCollector',
},
},
ACHIEVEMENT_SKELETON_CREW: {
achievement: true,
label: $t => `${$t('achievement')}: ${$t('achievementSkeletonCrew')}`,
modalId: 'generic-achievement',
data: {
achievement: 'skeletonCrew',
},
},
};
@@ -415,6 +431,7 @@ export default {
'ACHIEVEMENT_PEARLY_PRO', 'ACHIEVEMENT_TICKLED_PINK', 'ACHIEVEMENT_ROSY_OUTLOOK', 'ACHIEVEMENT',
'ONBOARDING_COMPLETE', 'FIRST_DROPS', 'ACHIEVEMENT_BUG_BONANZA', 'ACHIEVEMENT_BARE_NECESSITIES',
'ACHIEVEMENT_FRESHWATER_FRIENDS', 'ACHIEVEMENT_GOOD_AS_GOLD', 'ACHIEVEMENT_ALL_THAT_GLITTERS',
'ACHIEVEMENT_BONE_COLLECTOR', 'ACHIEVEMENT_SKELETON_CREW',
].forEach(type => {
handledNotifications[type] = true;
});
@@ -831,6 +848,8 @@ export default {
case 'ACHIEVEMENT_FRESHWATER_FRIENDS':
case 'ACHIEVEMENT_GOOD_AS_GOLD':
case 'ACHIEVEMENT_ALL_THAT_GLITTERS':
case 'ACHIEVEMENT_BONE_COLLECTOR':
case 'ACHIEVEMENT_SKELETON_CREW':
case 'GENERIC_ACHIEVEMENT':
this.showNotificationWithModal(notification);
break;
+7 -1
View File
@@ -91,5 +91,11 @@
"achievementGoodAsGoldModalText": "You collected all the Golden Pets!",
"achievementAllThatGlitters": "All That Glitters",
"achievementAllThatGlittersText": "Has tamed all Golden Mounts.",
"achievementAllThatGlittersModalText": "You tamed all the Golden Mounts!"
"achievementAllThatGlittersModalText": "You tamed all the Golden Mounts!",
"achievementBoneCollector": "Bone Collector",
"achievementBoneCollectorText": "Has collected all Skeleton pets.",
"achievementBoneCollectorModalText": "You collected all the Skeleton Pets!",
"achievementSkeletonCrew": "Skeleton Crew",
"achievementSkeletonCrewText": "Has tamed all Skeleton Mounts.",
"achievementSkeletonCrewModalText": "You tamed all the Skeleton Mounts!"
}
@@ -167,6 +167,11 @@
"monthlyMysteryItems": "Monthly Mystery Items",
"doubleDropCap": "Double the Drops",
"youAreSubscribed": "You are subscribed to Habitica",
"dropCapReached": "You found all items for the day!",
"dropCapExplanation": "Your drops will reset with your tasks tomorrow. However, youll continue to earn Gold, Experience, and Quest progress when completing tasks.",
"dropCapLearnMore": "Learn more about Habiticas drop system",
"lookingForMoreItems": "Looking for More Items?",
"dropCapSubs": "Habitica subscribers can find double the random items each day and receive monthly mystery items!",
"subscriptionCanceled": "Your subscription is canceled",
"subscriptionInactiveDate": "Your subscription benefits will become inactive on <strong><%= date %></strong>",
"subscriptionStats": "Subscription Stats",
@@ -212,6 +212,16 @@ const basicAchievs = {
titleKey: 'achievementAllThatGlitters',
textKey: 'achievementAllThatGlittersText',
},
boneCollector: {
icon: 'achievement-boneCollector',
titleKey: 'achievementBoneCollector',
textKey: 'achievementBoneCollectorText',
},
skeletonCrew: {
icon: 'achievement-skeletonCrew',
titleKey: 'achievementSkeletonCrew',
textKey: 'achievementSkeletonCrewText',
},
};
Object.assign(achievementsData, basicAchievs);
@@ -41,6 +41,13 @@ const ANIMAL_COLOR_ACHIEVEMENTS = [
mountAchievement: 'allThatGlitters',
mountNotificationType: 'ACHIEVEMENT_ALL_THAT_GLITTERS',
},
{
color: 'Skeleton',
petAchievement: 'boneCollector',
petNotificationType: 'ACHIEVEMENT_BONE_COLLECTOR',
mountAchievement: 'skeletonCrew',
mountNotificationType: 'ACHIEVEMENT_SKELETON_CREW',
},
];
export default ANIMAL_COLOR_ACHIEVEMENTS;
@@ -204,6 +204,8 @@ function _getBasicAchievements (user, language) {
_addSimple(result, user, { path: 'freshwaterFriends', language });
_addSimple(result, user, { path: 'goodAsGold', language });
_addSimple(result, user, { path: 'allThatGlitters', language });
_addSimple(result, user, { path: 'boneCollector', language });
_addSimple(result, user, { path: 'skeletonCrew', language });
_addSimpleWithMasterCount(result, user, { path: 'beastMaster', language });
_addSimpleWithMasterCount(result, user, { path: 'mountMaster', language });
Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

+1 -21
View File
@@ -52,26 +52,6 @@ async function unlockUser (user) {
}).exec();
}
// Enroll users in the Drop Cap A/B Test
function dropCapABTest (user, req) {
// Only target users that use web for cron and aren't subscribed.
// Those using mobile aren't excluded as they may use it later
const isWeb = req.headers['x-client'] === 'habitica-web';
if (isWeb && !user._ABtests.dropCapNotif && !user.isSubscribed()) {
const testGroup = Math.random();
// Enroll 20% of users, splitting them 50/50
if (testGroup <= 0.25) {
user._ABtests.dropCapNotif = 'drop-cap-notif-enabled';
} else if (testGroup <= 0.5) {
user._ABtests.dropCapNotif = 'drop-cap-notif-disabled';
} else {
user._ABtests.dropCapNotif = 'drop-cap-notif-not-enrolled';
}
user.markModified('_ABtests');
}
}
async function cronAsync (req, res) {
let { user } = res.locals;
if (!user) return null; // User might not be available when authentication is not mandatory
@@ -86,7 +66,7 @@ async function cronAsync (req, res) {
res.locals.user = user;
const { daysMissed, timezoneUtcOffsetFromUserPrefs } = user.daysUserHasMissed(now, req);
dropCapABTest(user, req);
user.enrollInDropCapABTest(req.headers['x-client']);
await updateLastCron(user, now);
if (daysMissed <= 0) {
+11
View File
@@ -12,6 +12,9 @@ import {
import {
model as Tag,
} from '../tag';
import {
model as NewsPost,
} from '../newsPost';
import { // eslint-disable-line import/no-cycle
userActivityWebhook,
} from '../../libs/webhook';
@@ -129,6 +132,12 @@ function pinBaseItems (user) {
}
function _setUpNewUser (user) {
// Mark the last news post as read
const lastNewsPost = NewsPost.lastNewsPost();
if (lastNewsPost) {
user.flags.lastNewStuffRead = lastNewsPost._id;
}
let taskTypes;
const iterableFlags = user.flags.toObject();
@@ -155,6 +164,8 @@ function _setUpNewUser (user) {
user.markModified('items achievements');
user.enrollInDropCapABTest(user.registeredThrough);
if (user.registeredThrough === 'habitica-web') {
taskTypes = ['habit', 'daily', 'todo', 'reward', 'tag'];
+20
View File
@@ -525,3 +525,23 @@ schema.methods.getSecretData = function getSecretData () {
return user.secret;
};
// Enroll users in the Drop Cap A/B Test
schema.methods.enrollInDropCapABTest = function enrollInDropCapABTest (xClientHeader) {
// Only target users that use web for cron and aren't subscribed.
// Those using mobile aren't excluded as they may use it later
const isWeb = xClientHeader === 'habitica-web';
if (isWeb && !this._ABtests.dropCapNotif && !this.isSubscribed()) {
const testGroup = Math.random();
// Enroll 20% of users, splitting them 50/50
if (testGroup <= 0.25) {
this._ABtests.dropCapNotif = 'drop-cap-notif-enabled';
} else if (testGroup <= 0.5) {
this._ABtests.dropCapNotif = 'drop-cap-notif-disabled';
} else {
this._ABtests.dropCapNotif = 'drop-cap-notif-not-enrolled';
}
this.markModified('_ABtests');
}
};
+2
View File
@@ -136,6 +136,8 @@ export default new Schema({
freshwaterFriends: Boolean,
goodAsGold: Boolean,
allThatGlitters: Boolean,
boneCollector: Boolean,
skeletonCrew: Boolean,
// Onboarding Guide
createdTask: Boolean,
completedTask: Boolean,
@@ -59,6 +59,8 @@ const NOTIFICATION_TYPES = [
'ACHIEVEMENT_FRESHWATER_FRIENDS',
'ACHIEVEMENT_GOOD_AS_GOLD',
'ACHIEVEMENT_ALL_THAT_GLITTERS',
'ACHIEVEMENT_BONE_COLLECTOR',
'ACHIEVEMENT_SKELETON_CREW',
'ACHIEVEMENT', // generic achievement notification, details inside `notification.data`
'DROP_CAP_REACHED',
];