Skip to content

Commit c5648ee

Browse files
committed
fix: add block list script
1 parent 18d4144 commit c5648ee

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

packages/velog-scripts/scripts/privatePostsOfSpamAccount.mts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,12 @@ class Runner implements IRunner {
2525
const user = await this.findUsersByUsername(username)
2626
const posts = await this.findWritenPostsByUserId(user.id)
2727

28-
// add block list
29-
await this.blockList.addBlockList(username)
28+
const blockList = await this.blockList.readBlockList()
29+
30+
if (blockList.includes(username)) {
31+
console.log(`${username} 유저는 이미 등록되어 있습니다.`)
32+
continue
33+
}
3034

3135
if (posts.length === 0) {
3236
console.log(`${user.username} 유저의 비공개 처리 할 게시글이 없습니다.`)
@@ -40,9 +44,12 @@ class Runner implements IRunner {
4044
user.profile?.display_name || null,
4145
)
4246

47+
if (!askResult.is_set_private) continue
48+
4349
const postIds = posts.map(({ id }) => id!)
50+
// add block list
51+
await this.blockList.addBlockList(username)
4452

45-
if (!askResult.is_set_private) continue
4653
// set private = true
4754
await this.setIsPrivatePost(postIds)
4855

0 commit comments

Comments
 (0)