mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 09:06:15 +01:00
fix: old upgrade script so it doesn't create settings objects
if they don't exist
This commit is contained in:
@@ -3,7 +3,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const db = require('../../database');
|
const db = require('../../database');
|
||||||
const user = require('../../user');
|
|
||||||
const batch = require('../../batch');
|
const batch = require('../../batch');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@@ -18,7 +17,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await batch.processSortedSet(`users:joindate`, async (uids) => {
|
await batch.processSortedSet(`users:joindate`, async (uids) => {
|
||||||
const userSettings = await user.getMultipleUserSettings(uids);
|
const userSettings = await db.getObjects(uids.map(uid => `user:${uid}:settings`));
|
||||||
const change = userSettings.filter(s => s && s.categoryWatchState === 'watching');
|
const change = userSettings.filter(s => s && s.categoryWatchState === 'watching');
|
||||||
await db.setObjectBulk(
|
await db.setObjectBulk(
|
||||||
change.map(s => [`user:${s.uid}:settings`, { categoryWatchState: 'tracking' }])
|
change.map(s => [`user:${s.uid}:settings`, { categoryWatchState: 'tracking' }])
|
||||||
|
|||||||
Reference in New Issue
Block a user