more timeout mess aroundary

This commit is contained in:
erik-sn committed 2020-11-21 10:09:20 -05:00
1 parent 9cccf91a84
commit 8191a9431c
5 files changed
+28 -23

No files matched your search

+5 -11
View File
@@ -180,17 +180,6 @@ async function checkIfMessageGroupExists(groupId: string): Promise<boolean> {
return count > 0;
}
async function getParticipantsByGroup(groupId: string): Promise<string[]> {
const query = `
SELECT participant_identifier as identifier
FROM npwd_messages_groups
WHERE group_id = ?;
`;
const [results] = await pool.query(query, [ groupId]);
const rows = (<any>results);
return rows.map((row: any) => row.identifier);
}
/**
* Consolidate raw message groups into a mapping that groups participants
* by the message group. The goal of this is to reduce the rows of message
@@ -267,6 +256,11 @@ async function createMessageGroupsFromPhoneNumbers(
}
}
// don't allow explicitly adding yourself
if (identifiers.some(identifier => identifier === userIdentifier)) {
return { error: true, mine: true };
}
// make sure we are always in a consistent order. It is very important
// that this not change! Changing this order can result in the ability
// of duplicate message groups being created.