fix: do not let mentioning members with their unblindedPubkey room blinded

pull/2489/head
Audric Ackermann 3 years ago
parent c848de74f7
commit 1411b93f2d

@ -9,6 +9,7 @@ import {
difference, difference,
forEach, forEach,
fromPairs, fromPairs,
isArray,
isEmpty, isEmpty,
isNumber, isNumber,
isObject, isObject,
@ -646,10 +647,23 @@ function getAllOpenGroupV2ConversationsIds(): Array<string> {
} }
function getPubkeysInPublicConversation(conversationId: string) { function getPubkeysInPublicConversation(conversationId: string) {
const conversation = getV2OpenGroupRoom(conversationId);
if (!conversation) {
return [];
}
const hasBlindOn = Boolean(
conversation.capabilities &&
isArray(conversation.capabilities) &&
conversation.capabilities?.includes('blind')
);
const whereClause = hasBlindOn ? 'AND source LIKE "15%"' : '';
const rows = assertGlobalInstance() const rows = assertGlobalInstance()
.prepare( .prepare(
`SELECT DISTINCT source FROM ${MESSAGES_TABLE} WHERE `SELECT DISTINCT source FROM ${MESSAGES_TABLE} WHERE
conversationId = $conversationId conversationId = $conversationId ${whereClause}
ORDER BY received_at DESC LIMIT ${MAX_PUBKEYS_MEMBERS};` ORDER BY received_at DESC LIMIT ${MAX_PUBKEYS_MEMBERS};`
) )
.all({ .all({

Loading…
Cancel
Save