mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-22 15:33:13 +01:00
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
25 lines
471 B
JavaScript
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);
|
|
};
|