mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-18 07:26:48 +00:00
fix(修复隐藏文章中无法显示只存在于隐藏文章中的标签的问题):
具体问题为:对于新打的标签,无法在隐藏文章里显示,只能显示之前添加好的旧标签。而将文章设置为公开,就能全部显示。 Closes #3322 #3038 #3137
This commit is contained in:
@@ -332,8 +332,6 @@ function handleDataBeforeReturn(db) {
|
||||
db.notice = cleanBlock(db?.notice)
|
||||
delete db.notice?.id
|
||||
}
|
||||
|
||||
db.tagOptions = cleanIds(db?.tagOptions)
|
||||
db.categoryOptions = cleanIds(db?.categoryOptions)
|
||||
db.customMenu = cleanIds(db?.customMenu)
|
||||
|
||||
@@ -344,6 +342,8 @@ function handleDataBeforeReturn(db) {
|
||||
db.allNavPages = cleanPages(db?.allNavPages, db.tagOptions)
|
||||
db.allPages = cleanPages(db.allPages, db.tagOptions)
|
||||
db.latestPosts = cleanPages(db.latestPosts, db.tagOptions)
|
||||
// 必须在使用完毕后才能进行清理
|
||||
db.tagOptions = cleanTagOptions(db?.tagOptions)
|
||||
|
||||
const POST_SCHEDULE_PUBLISH = siteConfig(
|
||||
'POST_SCHEDULE_PUBLISH',
|
||||
@@ -464,6 +464,22 @@ function cleanIds(items) {
|
||||
return items
|
||||
}
|
||||
|
||||
/**
|
||||
* 清理和过滤tagOptions
|
||||
* @param {*} tagOptions
|
||||
* @returns
|
||||
*/
|
||||
function cleanTagOptions(tagOptions) {
|
||||
if (tagOptions && Array.isArray(tagOptions)) {
|
||||
return deepClone(
|
||||
tagOptions
|
||||
.filter(tagOption => tagOption.source === 'Published')
|
||||
.map(({ id, source, ...newTagOption }) => newTagOption)
|
||||
)
|
||||
}
|
||||
return tagOptions
|
||||
}
|
||||
|
||||
/**
|
||||
* 清理block数据
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user