Files
NodeBB/src/socket.io/admin/themes.js
Barış Soner Uşaklı 1739f5a9e7 fix: #10276, only move widgets if area doesn't exist
when changing a theme save all locations that have widgets in them, after restart go through these locations and if they don't exist anymore move those widgets to drafts
2023-10-18 10:37:11 -04:00

25 lines
471 B
JavaScript

'use strict';
const meta = require('../../meta');
const widgets = require('../../widgets');
const Themes = module.exports;
Themes.getInstalled = async function () {
return await meta.themes.get();
};
Themes.set = async function (socket, data) {
if (!data) {
throw new Error('[[error:invalid-data]]');
}
if (data.type === 'local') {
await widgets.saveLocationsOnThemeReset();
}
data.ip = socket.ip;
data.uid = socket.uid;
await meta.themes.set(data);
};