refactor: remove duplicate code (#8895)
This commit is contained in:
parent
0ec266abf7
commit
bc3ae901cc
12 changed files with 41 additions and 64 deletions
|
@ -1,15 +0,0 @@
|
|||
export function isBlockerUserRelated(note: any, blockerUserIds: Set<string>): boolean {
|
||||
if (blockerUserIds.has(note.userId)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (note.reply != null && blockerUserIds.has(note.reply.userId)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (note.renote != null && blockerUserIds.has(note.renote.userId)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
export function isMutedUserRelated(note: any, mutedUserIds: Set<string>): boolean {
|
||||
if (mutedUserIds.has(note.userId)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (note.reply != null && mutedUserIds.has(note.reply.userId)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (note.renote != null && mutedUserIds.has(note.renote.userId)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
15
packages/backend/src/misc/is-user-related.ts
Normal file
15
packages/backend/src/misc/is-user-related.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
export function isUserRelated(note: any, userIds: Set<string>): boolean {
|
||||
if (userIds.has(note.userId)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (note.reply != null && userIds.has(note.reply.userId)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (note.renote != null && userIds.has(note.renote.userId)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue