fix: styleName undefined when rubrics used in generateCover
This commit is contained in:
@@ -395,13 +395,15 @@ async function generateCover({ articleId, title, tags = [], channelId = null })
|
|||||||
|
|
||||||
// Выбираем рубрику если они заданы
|
// Выбираем рубрику если они заданы
|
||||||
let selectedRubric = null;
|
let selectedRubric = null;
|
||||||
|
let styleName;
|
||||||
const rubrics = channelStyle?.image_rubrics;
|
const rubrics = channelStyle?.image_rubrics;
|
||||||
if (Array.isArray(rubrics) && rubrics.length > 0) {
|
if (Array.isArray(rubrics) && rubrics.length > 0) {
|
||||||
selectedRubric = await selectRubric({ title, tags, rubrics });
|
selectedRubric = await selectRubric({ title, tags, rubrics });
|
||||||
console.log(`[Cover] article=${articleId} channel=${channelId} rubric=${selectedRubric?.id}`);
|
styleName = selectedRubric?.id || 'rubric';
|
||||||
|
console.log(`[Cover] article=${articleId} channel=${channelId} rubric=${styleName}`);
|
||||||
} else {
|
} else {
|
||||||
const styleIdx = pickStyleIndex(articleId);
|
const styleIdx = pickStyleIndex(articleId);
|
||||||
const styleName = channelStyle?.image_style || COVER_STYLES[styleIdx].name;
|
styleName = channelStyle?.image_style || COVER_STYLES[styleIdx].name;
|
||||||
console.log(`[Cover] article=${articleId} channel=${channelId || 'none'} style=${styleName}`);
|
console.log(`[Cover] article=${articleId} channel=${channelId || 'none'} style=${styleName}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user