Refactor: Extract shouldMuteThisNote function
This commit is contained in:
parent
311b4e90ca
commit
44f6fe6f1f
6 changed files with 29 additions and 53 deletions
15
src/misc/should-mute-this-note.ts
Normal file
15
src/misc/should-mute-this-note.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
export default function(note: any, mutedUserIds: string[]): boolean {
|
||||
if (mutedUserIds.indexOf(note.userId) != -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (note.reply != null && mutedUserIds.indexOf(note.reply.userId) != -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (note.renote != null && mutedUserIds.indexOf(note.renote.userId) != -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue