mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-02-15 07:28:59 +00:00
24 lines
765 B
TypeScript
24 lines
765 B
TypeScript
// Copyright 2021 Signal Messenger, LLC
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
import type { ConversationModel } from '../models/conversations.preload.js';
|
|
import { isInSystemContacts } from './isInSystemContacts.std.js';
|
|
import { getSharedGroupNames } from './sharedGroupNames.dom.js';
|
|
import { isMe } from './whatTypeOfConversation.dom.js';
|
|
|
|
export function shouldRespondWithProfileKey(
|
|
sender: ConversationModel
|
|
): boolean {
|
|
if (isMe(sender.attributes) || sender.isBlocked()) {
|
|
return false;
|
|
}
|
|
|
|
if (isInSystemContacts(sender.attributes) || sender.get('profileSharing')) {
|
|
return true;
|
|
}
|
|
|
|
const state = window.reduxStore.getState();
|
|
const sharedGroupNames = getSharedGroupNames(state, sender.id);
|
|
return sharedGroupNames.length > 0;
|
|
}
|