diff --git a/src/api/gramjs/methods/calls.ts b/src/api/gramjs/methods/calls.ts index 893ce28bd..685f39a97 100644 --- a/src/api/gramjs/methods/calls.ts +++ b/src/api/gramjs/methods/calls.ts @@ -276,7 +276,7 @@ export async function requestCall({ })); if (!result) { - return; + return false; } const call = buildPhoneCall(result.phoneCall); @@ -285,6 +285,8 @@ export async function requestCall({ '@type': 'updatePhoneCall', call, }); + + return true; } export function setCallRating({ diff --git a/src/components/middle/message/MessagePhoneCall.module.scss b/src/components/middle/message/MessagePhoneCall.module.scss index 11b27025a..fc78cb7b2 100644 --- a/src/components/middle/message/MessagePhoneCall.module.scss +++ b/src/components/middle/message/MessagePhoneCall.module.scss @@ -36,6 +36,8 @@ .meta { display: flex; align-items: center; + position: relative; + left: -3px; } .duration { diff --git a/src/global/actions/api/calls.async.ts b/src/global/actions/api/calls.async.ts index cbfd92fff..8e485cfa6 100644 --- a/src/global/actions/api/calls.async.ts +++ b/src/global/actions/api/calls.async.ts @@ -212,7 +212,7 @@ addActionHandler('connectToActiveGroupCall', async (global, actions) => { } }); -addActionHandler('connectToActivePhoneCall', async (global) => { +addActionHandler('connectToActivePhoneCall', async (global, actions) => { const { phoneCall } = global; if (!phoneCall) return; @@ -229,7 +229,11 @@ addActionHandler('connectToActivePhoneCall', async (global) => { const gAHash = await callApi('requestPhoneCall', [dhConfig])!; - await callApi('requestCall', { user, gAHash, isVideo: phoneCall.isVideo }); + const result = await callApi('requestCall', { user, gAHash, isVideo: phoneCall.isVideo }); + + if (!result) { + actions.hangUp(); + } }); addActionHandler('acceptCall', async (global) => { diff --git a/src/global/actions/apiUpdaters/calls.ts b/src/global/actions/apiUpdaters/calls.ts index c58111fe9..8e2a60c2e 100644 --- a/src/global/actions/apiUpdaters/calls.ts +++ b/src/global/actions/apiUpdaters/calls.ts @@ -73,6 +73,7 @@ addActionHandler('apiUpdate', (global, actions, update) => { if (phoneCall) { if (call.state === 'discarded') { + actions.playGroupCallSound({ sound: 'end' }); return { ...global, ...(call.needRating && { ratingPhoneCall: call }),