fix(NewPostNotification): 修复更新检测逻辑以包含标题和描述变更

之前仅检测内容变更和发布日期更新,现在扩展检测逻辑以包含标题、描述等元数据的变更,确保任何修改都能正确触发更新通知。
This commit is contained in:
二叉树树
2026-01-25 21:43:53 +08:00
parent a08c717ed8
commit a33dce799a
2 changed files with 15 additions and 10 deletions

View File

@@ -486,16 +486,21 @@
// New post
detectedChanges.push({ ...post, isUpdated: false });
} else {
const dateUpdated = post.pubDate > stored.pubDate;
const contentChanged = post.content && stored.content && post.content !== stored.content;
// Check for ANY change (Title, Date, Description, Content)
const titleChanged = post.title !== stored.title;
const dateChanged = post.pubDate !== stored.pubDate;
const descriptionChanged = post.description !== stored.description;
const contentChanged = post.content !== stored.content;
if (contentChanged) {
const diff = computeDiff(stored.content, post.content);
if (diff) {
detectedChanges.push({ ...post, isUpdated: true, diff });
}
} else if (dateUpdated) {
detectedChanges.push({ ...post, isUpdated: true });
if (titleChanged || dateChanged || descriptionChanged || contentChanged) {
// Calculate diff only if content changed
const diff = contentChanged ? computeDiff(stored.content, post.content) : null;
detectedChanges.push({
...post,
isUpdated: true,
diff
});
}
}
});

View File

@@ -3,7 +3,7 @@ title: 加群向导
image: /random/h
published: 2025-05-24
pinned: true
description: 关于如何联系二叉树树~ 开始技术切磋!
description: 关于如何联系二叉树树~
---