mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
[MM-54494] Update selector to get profiles connected to calls (#24544)
* Update selector to get profiles connected to calls * Clean plugin version
This commit is contained in:
parent
0fb6e5169d
commit
db139627ff
@ -13,7 +13,7 @@ import {
|
||||
getChannelByName,
|
||||
getChannelMember,
|
||||
} from 'mattermost-redux/selectors/entities/channels';
|
||||
import {getCallsConfig, getCalls} from 'mattermost-redux/selectors/entities/common';
|
||||
import {getCallsConfig, getProfilesInCalls} from 'mattermost-redux/selectors/entities/common';
|
||||
import {getTeammateNameDisplaySetting} from 'mattermost-redux/selectors/entities/preferences';
|
||||
import {
|
||||
getCurrentTeam,
|
||||
@ -53,11 +53,11 @@ function getDefaultChannelId(state: GlobalState) {
|
||||
export function checkUserInCall(state: GlobalState, userId: string) {
|
||||
let isUserInCall = false;
|
||||
|
||||
const calls = getCalls(state);
|
||||
Object.keys(calls).forEach((channelId) => {
|
||||
const usersInCall = calls[channelId] || [];
|
||||
const profilesInCalls = getProfilesInCalls(state);
|
||||
Object.keys(profilesInCalls).forEach((channelId) => {
|
||||
const profiles = profilesInCalls[channelId] || [];
|
||||
|
||||
for (const user of usersInCall) {
|
||||
for (const user of profiles) {
|
||||
if (user.id === userId) {
|
||||
isUserInCall = true;
|
||||
break;
|
||||
|
@ -71,10 +71,10 @@ export function getUsers(state: GlobalState): IDMappedObjects<UserProfile> {
|
||||
|
||||
// Calls
|
||||
|
||||
export function getCalls(state: GlobalState): Record<string, UserProfile[]> {
|
||||
export function getProfilesInCalls(state: GlobalState): Record<string, UserProfile[]> {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
return state[CALLS_PLUGIN].voiceConnectedProfiles || {};
|
||||
return state[CALLS_PLUGIN].profiles || state[CALLS_PLUGIN].voiceConnectedProfiles || {};
|
||||
}
|
||||
|
||||
export function getCallsConfig(state: GlobalState): CallsConfig {
|
||||
|
@ -9,7 +9,7 @@ import type {GlobalState} from 'types/store';
|
||||
|
||||
export function isCallsEnabled(state: GlobalState, minVersion = '0.4.2') {
|
||||
return Boolean(state.plugins.plugins[suitePluginIds.calls] &&
|
||||
semver.gte(state.plugins.plugins[suitePluginIds.calls].version || '0.0.0', minVersion));
|
||||
semver.gte(String(semver.clean(state.plugins.plugins[suitePluginIds.calls].version || '0.0.0')), minVersion));
|
||||
}
|
||||
|
||||
// isCallsRingingEnabledOnServer is the flag for the ringing/notification feature in calls
|
||||
|
Loading…
Reference in New Issue
Block a user