SHA256
Добавить SHiNE теги в DM и безопасный рендер превью
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { addSignedMessageToChat, authService, authorizeSession, state } from '../state.js';
|
||||
import { buildDmCallTechBlock } from './dm-tech-blocks.js';
|
||||
|
||||
const TYPES = {
|
||||
INVITE: 100,
|
||||
@@ -113,23 +114,25 @@ function isInviteUndelivered(call) {
|
||||
function buildOutgoingCallSummaryText(call, summaryCode) {
|
||||
if (!call || call.direction !== 'out') return '';
|
||||
if (summaryCode === 'completed') {
|
||||
const duration = formatDuration(nowMs() - Number(call.connectedAtMs || call.startedAtMs || nowMs()));
|
||||
return `Звонок: ${duration}`;
|
||||
return buildDmCallTechBlock({
|
||||
status: 'completed',
|
||||
durationSec: Math.round(Math.max(0, nowMs() - Number(call.connectedAtMs || call.startedAtMs || nowMs())) / 1000),
|
||||
});
|
||||
}
|
||||
if (summaryCode === 'busy') {
|
||||
return 'Звонил, но недозвонился: абонент занят';
|
||||
return buildDmCallTechBlock({ status: 'failed', reason: 'busy' });
|
||||
}
|
||||
if (summaryCode === 'declined') {
|
||||
return 'Звонил, но недозвонился: звонок отклонён';
|
||||
return buildDmCallTechBlock({ status: 'failed', reason: 'declined' });
|
||||
}
|
||||
if (summaryCode === 'no_answer') {
|
||||
if (isInviteUndelivered(call)) {
|
||||
return 'Звонил, но недозвонился: абонент не в сети';
|
||||
return buildDmCallTechBlock({ status: 'failed', reason: 'offline' });
|
||||
}
|
||||
return 'Звонил, но недозвонился: нет ответа';
|
||||
return buildDmCallTechBlock({ status: 'failed', reason: 'no_answer' });
|
||||
}
|
||||
if (summaryCode === 'error') {
|
||||
return 'Звонил, но недозвонился: не удалось установить соединение';
|
||||
return buildDmCallTechBlock({ status: 'failed', reason: 'connect_failed' });
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user