using set instead of array for search (#7126)
* Resolve #6905 * Resolve #6905 * Resolve #6905
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user