Don't send to blocked users
This commit is contained in:
parent
de942e1af2
commit
fc62fd4564
9 changed files with 55 additions and 5 deletions
|
@ -1095,7 +1095,7 @@ export class SignalProtocolStore extends EventsMixin {
|
|||
throw new Error('getOpenDevices: this.sessions not yet cached!');
|
||||
}
|
||||
if (identifiers.length === 0) {
|
||||
throw new Error('getOpenDevices: No identifiers provided!');
|
||||
return { devices: [], emptyIdentifiers: [] };
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
|
@ -123,6 +123,12 @@ export async function sendDeleteForEveryone(
|
|||
);
|
||||
return;
|
||||
}
|
||||
if (conversation.isBlocked()) {
|
||||
log.info(
|
||||
`conversation ${conversation.idForLogging()} is blocked; refusing to send`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
await wrapWithSyncMessageSend({
|
||||
conversation,
|
||||
|
|
|
@ -115,6 +115,12 @@ export async function sendDirectExpirationTimerUpdate(
|
|||
);
|
||||
return;
|
||||
}
|
||||
if (conversation.isBlocked()) {
|
||||
log.info(
|
||||
`conversation ${conversation.idForLogging()} is blocked; refusing to send`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
await wrapWithSyncMessageSend({
|
||||
conversation,
|
||||
|
|
|
@ -229,6 +229,13 @@ export async function sendNormalMessage(
|
|||
]);
|
||||
return;
|
||||
}
|
||||
if (conversation.isBlocked()) {
|
||||
log.info(
|
||||
`conversation ${conversation.idForLogging()} is blocked; refusing to send`
|
||||
);
|
||||
markMessageFailed(message, [new Error('Contact is blocked')]);
|
||||
return;
|
||||
}
|
||||
|
||||
log.info('sending direct message');
|
||||
innerPromise = window.textsecure.messaging.sendMessageToIdentifier({
|
||||
|
|
|
@ -97,6 +97,12 @@ export async function sendProfileKey(
|
|||
);
|
||||
return;
|
||||
}
|
||||
if (conversation.isBlocked()) {
|
||||
log.info(
|
||||
`conversation ${conversation.idForLogging()} is blocked; refusing to send`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const proto = await window.textsecure.messaging.getContentMessage({
|
||||
flags: Proto.DataMessage.Flags.PROFILE_KEY_UPDATE,
|
||||
|
|
|
@ -196,6 +196,13 @@ export async function sendReaction(
|
|||
markReactionFailed(message, pendingReaction);
|
||||
return;
|
||||
}
|
||||
if (conversation.isBlocked()) {
|
||||
log.info(
|
||||
`conversation ${conversation.idForLogging()} is blocked; refusing to send`
|
||||
);
|
||||
markReactionFailed(message, pendingReaction);
|
||||
return;
|
||||
}
|
||||
|
||||
log.info('sending direct reaction message');
|
||||
promise = window.textsecure.messaging.sendMessageToIdentifier({
|
||||
|
|
|
@ -90,6 +90,12 @@ export class SingleProtoJobQueue extends JobQueue<SingleProtoJobData> {
|
|||
);
|
||||
return;
|
||||
}
|
||||
if (conversation.isBlocked()) {
|
||||
log.info(
|
||||
`conversation ${conversation.idForLogging()} is blocked; refusing to send`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const proto = Proto.Content.decode(Bytes.fromBase64(protoBase64));
|
||||
const options = await getSendOptions(conversation.attributes, {
|
||||
|
|
|
@ -27,8 +27,11 @@ export function getConversationMembers(
|
|||
members.map(member => {
|
||||
const conversation = window.ConversationController.get(member.uuid);
|
||||
|
||||
// In groups we won't sent to contacts we believe are unregistered
|
||||
if (conversation && conversation.isUnregistered()) {
|
||||
// In groups we won't sent to blocked contacts or those we think are unregistered
|
||||
if (
|
||||
conversation &&
|
||||
(conversation.isUnregistered() || conversation.isBlocked())
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -42,8 +45,11 @@ export function getConversationMembers(
|
|||
conversationAttrs.members.map(id => {
|
||||
const conversation = window.ConversationController.get(id);
|
||||
|
||||
// In groups we won't send to contacts we believe are unregistered
|
||||
if (conversation && conversation.isUnregistered()) {
|
||||
// In groups we won't sent to blocked contacts or those we think are unregistered
|
||||
if (
|
||||
conversation &&
|
||||
(conversation.isUnregistered() || conversation.isBlocked())
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -103,6 +103,12 @@ export async function sendReceipts({
|
|||
);
|
||||
return;
|
||||
}
|
||||
if (sender.isBlocked()) {
|
||||
log.info(
|
||||
`conversation ${sender.idForLogging()} is blocked; refusing to send`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const sendOptions = await getSendOptions(sender.attributes);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue