Release 1.5.16
This commit is contained in:
@@ -135,6 +135,11 @@ module.exports = function registerAdminContentRoutes(app, deps) {
|
||||
return Array.from(usage);
|
||||
}
|
||||
|
||||
async function fetchSlidesByTemplateId(templateId) {
|
||||
const [slides] = await pool.query('SELECT id, thumbnail_path FROM slides WHERE template_id = ? ORDER BY id ASC', [templateId]);
|
||||
return slides;
|
||||
}
|
||||
|
||||
function getRemovedTemplateRegionKeys(existingRegions, nextRegions) {
|
||||
const nextKeys = new Set((Array.isArray(nextRegions) ? nextRegions : []).map((region) => String(region && region.region_key || '').trim()).filter(Boolean));
|
||||
return (Array.isArray(existingRegions) ? existingRegions : [])
|
||||
@@ -171,6 +176,23 @@ module.exports = function registerAdminContentRoutes(app, deps) {
|
||||
});
|
||||
}
|
||||
|
||||
function queueTemplateSlideThumbnailRefresh(templateId) {
|
||||
if (!backgroundTaskQueue || typeof backgroundTaskQueue.enqueueTask !== 'function') {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
return backgroundTaskQueue.enqueueTask({
|
||||
key: 'template-slide-thumbnail:' + Number(templateId),
|
||||
title: 'Refresh slide thumbnails',
|
||||
category: 'slides',
|
||||
taskType: 'template-slide-thumbnail-refresh',
|
||||
payload: {
|
||||
templateId: Number(templateId)
|
||||
},
|
||||
persist: true
|
||||
});
|
||||
}
|
||||
|
||||
async function canvasSizeExists(width, height, ignoreId) {
|
||||
const params = [width, height];
|
||||
let query = 'SELECT COUNT(*) AS count FROM canvas_sizes WHERE width = ? AND height = ?';
|
||||
@@ -524,6 +546,12 @@ module.exports = function registerAdminContentRoutes(app, deps) {
|
||||
previousUploadRefs: existingUploadRefs,
|
||||
nextUploadRefs: nextUploadRefs
|
||||
});
|
||||
const templateSlides = await fetchSlidesByTemplateId(template.id);
|
||||
if (templateSlides.length > 0) {
|
||||
queueTemplateSlideThumbnailRefresh(template.id).catch(function (error) {
|
||||
console.warn('Unable to queue template slide thumbnail refresh:', error);
|
||||
});
|
||||
}
|
||||
await notifyPlayerScreens(affectedScreens, 'refresh');
|
||||
redirectAfterSave(req, res, '/templates/' + template.id + '/edit', {
|
||||
closeUrl: '/templates',
|
||||
|
||||
Reference in New Issue
Block a user