Skip to content

Commit

Permalink
chore: rename unclear variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshinorin committed Apr 19, 2024
1 parent f782736 commit 03379e8
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/plugins/processor/post.ts
Expand Up @@ -269,11 +269,11 @@ function processAsset(ctx: Hexo, file: _File) {
const PostAsset = ctx.model('PostAsset');
const Post = ctx.model('Post');
const id = file.source.substring(ctx.base_dir.length);
const doc = PostAsset.findById(id);
const postAsset = PostAsset.findById(id);

if (file.type === 'delete' || Post.length === 0) {
if (doc) {
return doc.remove();
if (postAsset) {
return postAsset.remove();
}
return;
}
Expand All @@ -288,9 +288,9 @@ function processAsset(ctx: Hexo, file: _File) {
});
};

if (doc) {
// `doc.post` is `Post.id`.
const post = Post.findById(doc.post);
if (postAsset) {
// `postAsset.post` is `Post.id`.
const post = Post.findById(postAsset.post);
if (post != null && (post.published || ctx._showDrafts())) {
return savePostAsset(post);
}
Expand All @@ -303,7 +303,7 @@ function processAsset(ctx: Hexo, file: _File) {
}

// NOTE: Probably, unreachable.
if (doc) {
return doc.remove();
if (postAsset) {
return postAsset.remove();
}
}

0 comments on commit 03379e8

Please sign in to comment.