Group Calls: Fix call indicator not updating (#2367)

This commit is contained in:
Alexander Zinchuk 2023-01-28 02:16:08 +01:00
parent bb34e6ae5a
commit e1f4d12c45
2 changed files with 24 additions and 1 deletions

View File

@ -978,6 +978,13 @@ export function updater(update: Update, originRequest?: GramJs.AnyRequest) {
} else if (update instanceof GramJs.UpdateSavedGifs) {
onUpdate({ '@type': 'updateSavedGifs' });
} else if (update instanceof GramJs.UpdateGroupCall) {
// eslint-disable-next-line no-underscore-dangle
const entities = update._entities;
if (entities) {
addEntitiesWithPhotosToLocalDb(entities);
dispatchUserAndChatUpdates(entities);
}
onUpdate({
'@type': 'updateGroupCall',
call: buildApiGroupCall(update.call),

View File

@ -5,7 +5,7 @@ import { selectChat } from '../../selectors';
import { updateChat } from '../../reducers';
import { ARE_CALLS_SUPPORTED } from '../../../util/environment';
import { notifyAboutCall } from '../../../util/notifications';
import { selectPhoneCallUser } from '../../selectors/calls';
import { selectGroupCall, selectPhoneCallUser } from '../../selectors/calls';
import { checkNavigatorUserMediaPermissions, initializeSoundsForSafari } from '../ui/calls';
import { onTickEnd } from '../../../util/schedulers';
import type { ActionReturnType } from '../../types';
@ -24,6 +24,14 @@ addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => {
}
}
const groupCall = selectGroupCall(global, update.call.id);
const chatId = groupCall?.chatId;
if (chatId) {
global = updateChat(global, chatId, {
isCallNotEmpty: (groupCall.participantsCount > 0 || Boolean(groupCall.participants?.length)),
});
}
return updateGroupCall(
global,
update.call.id,
@ -62,6 +70,14 @@ addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => {
nextOffset,
});
}
const groupCall = selectGroupCall(global, groupCallId);
const chatId = groupCall?.chatId;
if (chatId) {
global = updateChat(global, chatId, {
isCallNotEmpty: (groupCall.participantsCount > 0 || Boolean(groupCall.participants?.length)),
});
}
return global;
}
case 'updatePhoneCall': {