[MM-54494] Update selector to get profiles connected to calls (#24544)

* Update selector to get profiles connected to calls

* Clean plugin version
Этот коммит содержится в:
Claudio Costa
2023-09-14 15:23:18 -06:00
коммит произвёл GitHub
родитель 0fb6e5169d
Коммит db139627ff
3 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@@ -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