using set instead of array for search (#7126)

* Resolve #6905

* Resolve #6905

* Resolve #6905
This commit is contained in:
Ehsan Javadynia
2021-01-30 05:39:46 +03:30
committed by GitHub
parent 100a131913
commit ff67fb337e
7 changed files with 18 additions and 18 deletions

View File

@@ -1,13 +1,13 @@
export function isMutedUserRelated(note: any, mutedUserIds: string[]): boolean {
if (mutedUserIds.includes(note.userId)) {
export function isMutedUserRelated(note: any, mutedUserIds: Set<string>): boolean {
if (mutedUserIds.has(note.userId)) {
return true;
}
if (note.reply != null && mutedUserIds.includes(note.reply.userId)) {
if (note.reply != null && mutedUserIds.has(note.reply.userId)) {
return true;
}
if (note.renote != null && mutedUserIds.includes(note.renote.userId)) {
if (note.renote != null && mutedUserIds.has(note.renote.userId)) {
return true;
}