Skip to content

Commit f05235f

Browse files
committed
Merge branch 'develop' of https://github.com/HabitRPG/habitica into add-transaction-to-challenge-join
2 parents bbfc7a4 + 1c40044 commit f05235f

File tree

104 files changed

+32241
-47780
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+32241
-47780
lines changed

config.json.example

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"NODE_DB_URI": "mongodb://localhost:27017/habitica-dev?replicaSet=rs",
3838
"TEST_DB_URI": "mongodb://localhost:27017/habitica-test?replicaSet=rs",
3939
"MONGODB_POOL_SIZE": "10",
40+
"MONGODB_SOCKET_TIMEOUT": "20000",
4041
"NODE_ENV": "development",
4142
"PATH": "bin:node_modules/.bin:/usr/local/bin:/usr/bin:/bin",
4243
"PAYPAL_BILLING_PLANS_basic_12mo": "basic_12mo",

gulp/gulp-sprites.js

+33-2
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,41 @@ function cssVarMap (sprite) {
4242
}
4343
}
4444

45-
function createSpritesStream (name, src) {
45+
function filterFile (file) {
46+
if (file.relative.indexOf('Mount_Icon_') !== -1) {
47+
return false;
48+
}
49+
if (file.path.indexOf('shop/') !== -1) {
50+
return false;
51+
}
52+
if (file.path.indexOf('stable/eggs') !== -1) {
53+
return false;
54+
}
55+
if (file.path.indexOf('stable/food') !== -1) {
56+
return false;
57+
}
58+
if (file.path.indexOf('stable/potions') !== -1) {
59+
return false;
60+
}
61+
if (file.relative.indexOf('shop_') === 0) {
62+
return false;
63+
}
64+
if (file.relative.indexOf('icon_background') === 0) {
65+
return false;
66+
}
67+
return true;
68+
}
69+
70+
async function createSpritesStream (name, src) {
4671
const stream = mergeStream();
72+
// need to import this way bc of weird dependency things
73+
// eslint-disable-next-line global-require
74+
const filter = require('gulp-filter');
75+
76+
const f = filter(filterFile);
4777

4878
const spriteData = gulp.src(src)
79+
.pipe(f)
4980
.pipe(spritesmith({
5081
imgName: `spritesmith-${name}.png`,
5182
cssName: `spritesmith-${name}.css`,
@@ -63,7 +94,7 @@ function createSpritesStream (name, src) {
6394
return stream;
6495
}
6596

66-
gulp.task('sprites:main', () => {
97+
gulp.task('sprites:main', async () => {
6798
const mainSrc = sync('habitica-images/**/*.png');
6899
return createSpritesStream('main', mainSrc);
69100
});

habitica-images

Submodule habitica-images updated 57 files
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/* eslint-disable no-console */
2+
import { model as User } from '../../../website/server/models/user';
3+
4+
const MIGRATION_NAME = '2024_purge_invite_accepted';
5+
const progressCount = 1000;
6+
let count = 0;
7+
8+
async function updateUsers (userIds) {
9+
count += userIds.length;
10+
if (count % progressCount === 0) console.warn(`${count} ${userIds[0]}`);
11+
12+
return await User.updateMany(
13+
{ _id: { $in: userIds } },
14+
{ $pull: { notifications: { type: 'GROUP_INVITE_ACCEPTED' } } },
15+
).exec();
16+
}
17+
18+
export default async function processUsers () {
19+
let query = {
20+
migration: { $ne: MIGRATION_NAME },
21+
'notifications.type': 'GROUP_INVITE_ACCEPTED',
22+
'auth.timestamps.loggedin': { $gt: new Date('2024-06-25') },
23+
};
24+
25+
while (true) { // eslint-disable-line no-constant-condition
26+
const users = await User // eslint-disable-line no-await-in-loop
27+
.find(query)
28+
.limit(250)
29+
.sort({ _id: 1 })
30+
.select({ _id: 1 })
31+
.exec();
32+
33+
if (users.length === 0) {
34+
console.warn('All appropriate users found and modified.');
35+
console.warn(`\n${count} users processed\n`);
36+
break;
37+
} else {
38+
query._id = {
39+
$gt: users[users.length - 1],
40+
};
41+
}
42+
43+
const userIds = users.map(user => user._id);
44+
45+
await updateUsers(userIds); // eslint-disable-line no-await-in-loop
46+
}
47+
};

migrations/archive/2023/20230731_naming_day.js renamed to migrations/users/naming-day.js

+10-12
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
/* eslint-disable no-console */
2-
const MIGRATION_NAME = '20230731_naming_day';
3-
import { v4 as uuid } from 'uuid';
4-
5-
import { model as User } from '../../../website/server/models/user';
2+
import { model as User } from '../../website/server/models/user';
63

4+
const MIGRATION_NAME = '20240731_naming_day';
75
const progressCount = 1000;
86
let count = 0;
97

108
async function updateUser (user) {
11-
count++;
9+
count += 1;
1210

1311
let set;
1412
let push;
@@ -115,16 +113,16 @@ async function updateUser (user) {
115113
if (count % progressCount === 0) console.warn(`${count} ${user._id}`);
116114

117115
if (push) {
118-
return await user.updateOne({ $set: set, $inc: inc, $push: push }).exec();
119-
} else {
120-
return await user.updateOne({ $set: set, $inc: inc }).exec();
116+
return user.updateOne({ $set: set, $inc: inc, $push: push }).exec();
121117
}
118+
119+
return user.updateOne({ $set: set, $inc: inc }).exec();
122120
}
123121

124122
export default async function processUsers () {
125-
let query = {
123+
const query = {
126124
migration: { $ne: MIGRATION_NAME },
127-
'auth.timestamps.loggedin': { $gt: new Date('2023-07-01') },
125+
'auth.timestamps.loggedin': { $gt: new Date('2024-07-01') },
128126
};
129127

130128
const fields = {
@@ -136,7 +134,7 @@ export default async function processUsers () {
136134
const users = await User // eslint-disable-line no-await-in-loop
137135
.find(query)
138136
.limit(250)
139-
.sort({_id: 1})
137+
.sort({ _id: 1 })
140138
.select(fields)
141139
.exec();
142140

@@ -152,4 +150,4 @@ export default async function processUsers () {
152150

153151
await Promise.all(users.map(updateUser)); // eslint-disable-line no-await-in-loop
154152
}
155-
};
153+
}

0 commit comments

Comments
 (0)