From a969134bac98b59c1db83300ad45a4848b788eb3 Mon Sep 17 00:00:00 2001 From: Hossein Mehrabi Date: Mon, 11 Sep 2023 14:17:44 +0330 Subject: [PATCH] fix: compare highlighted and draft props; refs #177 --- src/services/unbody/unbody.service.ts | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/services/unbody/unbody.service.ts b/src/services/unbody/unbody.service.ts index 5a2814f..35c4f3d 100644 --- a/src/services/unbody/unbody.service.ts +++ b/src/services/unbody/unbody.service.ts @@ -265,9 +265,20 @@ export class UnbodyService { record, }) } else { - const newDate = getRecordDate(record) - const oldDate = getRecordDate(oldRecord) - const isUpdated = +newDate > +oldDate || record.slug !== oldRecord.slug + const isUpdated = + JSON.stringify([ + getRecordDate(record), + record.slug, + record.isDraft, + 'highlighted' in record && record.highlighted, + ]) !== + JSON.stringify([ + getRecordDate(oldRecord), + oldRecord.slug, + oldRecord.isDraft, + 'highlighted' in oldRecord && oldRecord.highlighted, + ]) + if (!isUpdated) continue changes.push({ @@ -326,9 +337,9 @@ export class UnbodyService { return `${ action !== 'unpublish' && record.isDraft ? 'Draft page' : 'Page' - } ${actionMessage}\n${pageType} "${record.title}" (${formatRFC7231( + } ${actionMessage}\n${pageType} "${record.title}" - ${formatRFC7231( getRecordDate(record), - )}).\n ${pageUrl}` + )}.\n ${pageUrl}` } for (const change of changes) {