fix: compare highlighted and draft props; refs #177

This commit is contained in:
Hossein Mehrabi 2023-09-11 14:17:44 +03:30
parent 1a29846be9
commit a969134bac
No known key found for this signature in database
GPG Key ID: 45C04964191AFAA1
1 changed files with 16 additions and 5 deletions

View File

@ -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) {