http-request-manager 18.5.21 → 18.5.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2904,6 +2904,10 @@ const defaultState = {
|
|
|
2904
2904
|
dataObject: null,
|
|
2905
2905
|
};
|
|
2906
2906
|
class HTTPManagerStateService extends ComponentStore {
|
|
2907
|
+
// Convenience observable that returns users for a specific channel
|
|
2908
|
+
getUsersForChannel$(channel) {
|
|
2909
|
+
return this.userListByChannel$.pipe(map(channelMap => channelMap.get(channel) || []));
|
|
2910
|
+
}
|
|
2907
2911
|
constructor(apiOptions = ApiRequest.adapt(), dataType, database) {
|
|
2908
2912
|
super(defaultState);
|
|
2909
2913
|
this.apiOptions = apiOptions;
|
|
@@ -2929,6 +2933,9 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
2929
2933
|
this.wsRetryAttempts$ = this.wsRetryAttempts.asObservable();
|
|
2930
2934
|
this.messages = new BehaviorSubject([]);
|
|
2931
2935
|
this.messages$ = this.messages.asObservable();
|
|
2936
|
+
this.userListByChannel = new BehaviorSubject(new Map());
|
|
2937
|
+
this.userListByChannel$ = this.userListByChannel.asObservable();
|
|
2938
|
+
// Legacy support - returns all unique users across all channels
|
|
2932
2939
|
this.userList = new BehaviorSubject([]);
|
|
2933
2940
|
this.userList$ = this.userList.asObservable();
|
|
2934
2941
|
this.user = new BehaviorSubject(null);
|
|
@@ -3015,8 +3022,15 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
3015
3022
|
}
|
|
3016
3023
|
break;
|
|
3017
3024
|
case 'usersInChannel':
|
|
3018
|
-
console.log(
|
|
3019
|
-
|
|
3025
|
+
console.log(`👥 Users in channel "${message.channel}":`, message.data.users);
|
|
3026
|
+
// Update channel-specific user list
|
|
3027
|
+
const currentMap = new Map(this.userListByChannel.value);
|
|
3028
|
+
currentMap.set(message.channel, message.data.users);
|
|
3029
|
+
this.userListByChannel.next(currentMap);
|
|
3030
|
+
// Update legacy userList with unique users across all channels
|
|
3031
|
+
const allUsers = Array.from(currentMap.values()).flat();
|
|
3032
|
+
const uniqueUsers = allUsers.filter((user, index, self) => index === self.findIndex(u => u.id === user.id));
|
|
3033
|
+
this.userList.next(uniqueUsers);
|
|
3020
3034
|
break;
|
|
3021
3035
|
default:
|
|
3022
3036
|
// Messages are already added at the beginning of the tap
|