Fix initial direct call from unknown contacts
This commit is contained in:
parent
9bb0a46aad
commit
d215e1b9be
3 changed files with 15 additions and 4 deletions
|
@ -88,6 +88,7 @@ import {
|
|||
} from '../services/notifications';
|
||||
import { storageServiceUploadJob } from '../services/storage';
|
||||
import { getSendOptions } from '../util/getSendOptions';
|
||||
import type { IsConversationAcceptedOptionsType } from '../util/isConversationAccepted';
|
||||
import { isConversationAccepted } from '../util/isConversationAccepted';
|
||||
import {
|
||||
getNumber,
|
||||
|
@ -2801,8 +2802,8 @@ export class ConversationModel extends window.Backbone
|
|||
* Determine if this conversation should be considered "accepted" in terms
|
||||
* of message requests
|
||||
*/
|
||||
getAccepted(): boolean {
|
||||
return isConversationAccepted(this.attributes);
|
||||
getAccepted(options?: IsConversationAcceptedOptionsType): boolean {
|
||||
return isConversationAccepted(this.attributes, options);
|
||||
}
|
||||
|
||||
onMemberVerifiedChange(): void {
|
||||
|
|
|
@ -1682,7 +1682,10 @@ export class CallingClass {
|
|||
return;
|
||||
}
|
||||
|
||||
if (callingMessage.offer && !conversation.getAccepted()) {
|
||||
if (
|
||||
callingMessage.offer &&
|
||||
!conversation.getAccepted({ ignoreEmptyConvo: true })
|
||||
) {
|
||||
log.info(
|
||||
'Conversation was not approved by user; rejecting call message.'
|
||||
);
|
||||
|
|
|
@ -6,13 +6,19 @@ import { SignalService as Proto } from '../protobuf';
|
|||
import { isDirectConversation, isMe } from './whatTypeOfConversation';
|
||||
import { isInSystemContacts } from './isInSystemContacts';
|
||||
|
||||
export type IsConversationAcceptedOptionsType = {
|
||||
ignoreEmptyConvo: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* Determine if this conversation should be considered "accepted" in terms
|
||||
* of message requests
|
||||
*/
|
||||
export function isConversationAccepted(
|
||||
conversationAttrs: ConversationAttributesType,
|
||||
{ ignoreEmptyConvo = false } = {}
|
||||
{ ignoreEmptyConvo }: IsConversationAcceptedOptionsType = {
|
||||
ignoreEmptyConvo: false,
|
||||
}
|
||||
): boolean {
|
||||
if (isMe(conversationAttrs)) {
|
||||
return true;
|
||||
|
@ -36,6 +42,7 @@ export function isConversationAccepted(
|
|||
(conversationAttrs.messageCountBeforeMessageRequests || 0) > 0;
|
||||
const hasNoMessages = (conversationAttrs.messageCount || 0) === 0;
|
||||
|
||||
// We don't want to show the message request UI in an empty conversation.
|
||||
const isEmptyPrivateConvo =
|
||||
hasNoMessages &&
|
||||
isDirectConversation(conversationAttrs) &&
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue