Batch and de-duplicate profile key updates
This commit is contained in:
parent
c2a0072fa1
commit
e51260a23f
2 changed files with 35 additions and 31 deletions
|
@ -1,25 +1,11 @@
|
|||
// Copyright 2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { MessageModel } from '../models/messages';
|
||||
import { assert } from './assert';
|
||||
import { ConversationModel } from '../models/conversations';
|
||||
|
||||
export async function shouldRespondWithProfileKey(
|
||||
message: MessageModel
|
||||
sender: ConversationModel
|
||||
): Promise<boolean> {
|
||||
if (!message.isIncoming() || message.get('unidentifiedDeliveryReceived')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const sender = message.getContact();
|
||||
if (!sender) {
|
||||
assert(
|
||||
false,
|
||||
'MessageModel#shouldRespondWithProfileKey had no sender. Returning false'
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sender.isMe() || !sender.getAccepted() || sender.isBlocked()) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue