Node.js based forum software built for the modern web
fix: closes #11511
Barış Soner Uşaklıec8d8ec45baa
diff --git a/src/upgrades/3.1.0/reset_user_bootswatch_skin.js b/src/upgrades/3.1.0/reset_user_bootswatch_skin.jsnew file mode 100644index 0000000000..21d5569b39--- /dev/null+++ b/src/upgrades/3.1.0/reset_user_bootswatch_skin.js@@ -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,+ });+ },+};