mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-30 02:25:55 +01:00
fix: closes #11511
reset all user skins if they are no longer available
This commit is contained in:
24
src/upgrades/3.1.0/reset_user_bootswatch_skin.js
Normal file
24
src/upgrades/3.1.0/reset_user_bootswatch_skin.js
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
const db = require('../../database');
|
||||
|
||||
module.exports = {
|
||||
name: 'Reset old bootswatch skin for all users',
|
||||
timestamp: Date.UTC(2023, 4, 1),
|
||||
method: async function () {
|
||||
const batch = require('../../batch');
|
||||
const css = require('../../meta/css');
|
||||
|
||||
batch.processSortedSet('users:joindate', async (uids) => {
|
||||
let settings = await db.getObjects(uids.map(uid => `user:${uid}:settings`));
|
||||
settings = settings.filter(
|
||||
s => s && s.bootswatchSkin && !css.supportedSkins.includes(s.bootswatchSkin)
|
||||
);
|
||||
|
||||
await db.setObjectBulk(settings.map(s => ([`user:${s.uid}`, { bootswatchSkin: '' }])));
|
||||
}, {
|
||||
batch: 500,
|
||||
});
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user