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