From ff67fb337ea74099ba45e705473d46cd1eb65128 Mon Sep 17 00:00:00 2001 From: Ehsan Javadynia <31900907+ehsanjavadynia@users.noreply.github.com> Date: Sat, 30 Jan 2021 05:39:46 +0330 Subject: using set instead of array for search (#7126) * Resolve #6905 * Resolve #6905 * Resolve #6905 --- src/server/api/stream/index.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/server/api/stream/index.ts') diff --git a/src/server/api/stream/index.ts b/src/server/api/stream/index.ts index 36e08ec05f..5b975d07db 100644 --- a/src/server/api/stream/index.ts +++ b/src/server/api/stream/index.ts @@ -19,9 +19,9 @@ import { UserProfile } from '../../../models/entities/user-profile'; export default class Connection { public user?: User; public userProfile?: UserProfile; - public following: User['id'][] = []; - public muting: User['id'][] = []; - public followingChannels: ChannelModel['id'][] = []; + public following: Set = new Set(); + public muting: Set = new Set(); + public followingChannels: Set = new Set(); public token?: AccessToken; private wsConnection: websocket.connection; public subscriber: EventEmitter; @@ -267,7 +267,7 @@ export default class Connection { select: ['followeeId'] }); - this.following = followings.map(x => x.followeeId); + this.following = new Set(followings.map(x => x.followeeId)); } @autobind @@ -279,7 +279,7 @@ export default class Connection { select: ['muteeId'] }); - this.muting = mutings.map(x => x.muteeId); + this.muting = new Set(mutings.map(x => x.muteeId)); } @autobind @@ -291,7 +291,7 @@ export default class Connection { select: ['followeeId'] }); - this.followingChannels = followings.map(x => x.followeeId); + this.followingChannels = new Set(followings.map(x => x.followeeId)); } @autobind -- cgit v1.2.3-freya