Add group calling events to the message timeline
This commit is contained in:
parent
a2f285d243
commit
0c039bf431
29 changed files with 1275 additions and 239 deletions
|
@ -145,6 +145,7 @@ const dataInterface: ServerInterface = {
|
|||
getMessageMetricsForConversation,
|
||||
getLastConversationActivity,
|
||||
getLastConversationPreview,
|
||||
hasGroupCallHistoryMessage,
|
||||
migrateConversationMessages,
|
||||
|
||||
getUnprocessedCount,
|
||||
|
@ -2880,6 +2881,34 @@ async function getMessageMetricsForConversation(conversationId: string) {
|
|||
}
|
||||
getMessageMetricsForConversation.needsSerial = true;
|
||||
|
||||
async function hasGroupCallHistoryMessage(
|
||||
conversationId: string,
|
||||
eraId: string
|
||||
): Promise<boolean> {
|
||||
const db = getInstance();
|
||||
|
||||
const row: unknown = await db.get(
|
||||
`
|
||||
SELECT count(*) FROM messages
|
||||
WHERE conversationId = $conversationId
|
||||
AND type = 'call-history'
|
||||
AND json_extract(json, '$.callHistoryDetails.callMode') = 'Group'
|
||||
AND json_extract(json, '$.callHistoryDetails.eraId') = $eraId
|
||||
LIMIT 1;
|
||||
`,
|
||||
{
|
||||
$conversationId: conversationId,
|
||||
$eraId: eraId,
|
||||
}
|
||||
);
|
||||
|
||||
if (typeof row === 'object' && row && !Array.isArray(row)) {
|
||||
const count = Number((row as Record<string, unknown>)['count(*)']);
|
||||
return Boolean(count);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
async function migrateConversationMessages(
|
||||
obsoleteId: string,
|
||||
currentId: string
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue