summaryrefslogtreecommitdiff
path: root/src/server/api/stream/index.ts
diff options
context:
space:
mode:
authorEhsan Javadynia <31900907+ehsanjavadynia@users.noreply.github.com>2021-01-30 05:39:46 +0330
committerGitHub <noreply@github.com>2021-01-30 11:09:46 +0900
commitff67fb337ea74099ba45e705473d46cd1eb65128 (patch)
treedbfd0ffe7452e0d6638c2530d7d9991a8d3cd41f /src/server/api/stream/index.ts
parentpages refactoring, fix bug (#7066) (diff)
downloadsharkey-ff67fb337ea74099ba45e705473d46cd1eb65128.tar.gz
sharkey-ff67fb337ea74099ba45e705473d46cd1eb65128.tar.bz2
sharkey-ff67fb337ea74099ba45e705473d46cd1eb65128.zip
using set instead of array for search (#7126)
* Resolve #6905 * Resolve #6905 * Resolve #6905
Diffstat (limited to 'src/server/api/stream/index.ts')
-rw-r--r--src/server/api/stream/index.ts12
1 files changed, 6 insertions, 6 deletions
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<User['id']> = new Set();
+ public muting: Set<User['id']> = new Set();
+ public followingChannels: Set<ChannelModel['id']> = 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<string>(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<string>(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<string>(followings.map(x => x.followeeId));
}
@autobind