Don't send messages to blocked group members
This commit is contained in:
parent
c7290309d3
commit
688938b5a1
3 changed files with 42 additions and 16 deletions
|
@ -1655,12 +1655,8 @@ export default class MessageSender {
|
|||
|
||||
const myE164 = window.textsecure.storage.user.getNumber();
|
||||
const myUuid = window.textsecure.storage.user.getUuid();
|
||||
// prettier-ignore
|
||||
const recipients = groupV2
|
||||
? groupV2.members
|
||||
: groupV1
|
||||
? groupV1.members
|
||||
: [];
|
||||
|
||||
const groupMembers = groupV2?.members || groupV1?.members || [];
|
||||
|
||||
// We should always have a UUID but have this check just in case we don't.
|
||||
let isNotMe: (recipient: string) => boolean;
|
||||
|
@ -1670,8 +1666,17 @@ export default class MessageSender {
|
|||
isNotMe = r => r !== myE164;
|
||||
}
|
||||
|
||||
const blockedIdentifiers = new Set([
|
||||
...window.storage.getBlockedUuids(),
|
||||
...window.storage.getBlockedNumbers(),
|
||||
]);
|
||||
|
||||
const recipients = groupMembers.filter(
|
||||
recipient => isNotMe(recipient) && !blockedIdentifiers.has(recipient)
|
||||
);
|
||||
|
||||
const attrs = {
|
||||
recipients: recipients.filter(isNotMe),
|
||||
recipients,
|
||||
body: messageText,
|
||||
timestamp,
|
||||
attachments,
|
||||
|
|
3
ts/window.d.ts
vendored
3
ts/window.d.ts
vendored
|
@ -171,6 +171,9 @@ declare global {
|
|||
<T = any>(key: string): T | undefined;
|
||||
<T>(key: string, defaultValue: T): T;
|
||||
};
|
||||
getBlockedGroups: () => Array<string>;
|
||||
getBlockedNumbers: () => Array<string>;
|
||||
getBlockedUuids: () => Array<string>;
|
||||
getItemsState: () => WhatIsThis;
|
||||
isBlocked: (number: string) => boolean;
|
||||
isGroupBlocked: (group: unknown) => boolean;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue