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';
|
} from '../services/notifications';
|
||||||
import { storageServiceUploadJob } from '../services/storage';
|
import { storageServiceUploadJob } from '../services/storage';
|
||||||
import { getSendOptions } from '../util/getSendOptions';
|
import { getSendOptions } from '../util/getSendOptions';
|
||||||
|
import type { IsConversationAcceptedOptionsType } from '../util/isConversationAccepted';
|
||||||
import { isConversationAccepted } from '../util/isConversationAccepted';
|
import { isConversationAccepted } from '../util/isConversationAccepted';
|
||||||
import {
|
import {
|
||||||
getNumber,
|
getNumber,
|
||||||
|
@ -2801,8 +2802,8 @@ export class ConversationModel extends window.Backbone
|
||||||
* Determine if this conversation should be considered "accepted" in terms
|
* Determine if this conversation should be considered "accepted" in terms
|
||||||
* of message requests
|
* of message requests
|
||||||
*/
|
*/
|
||||||
getAccepted(): boolean {
|
getAccepted(options?: IsConversationAcceptedOptionsType): boolean {
|
||||||
return isConversationAccepted(this.attributes);
|
return isConversationAccepted(this.attributes, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
onMemberVerifiedChange(): void {
|
onMemberVerifiedChange(): void {
|
||||||
|
|
|
@ -1682,7 +1682,10 @@ export class CallingClass {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (callingMessage.offer && !conversation.getAccepted()) {
|
if (
|
||||||
|
callingMessage.offer &&
|
||||||
|
!conversation.getAccepted({ ignoreEmptyConvo: true })
|
||||||
|
) {
|
||||||
log.info(
|
log.info(
|
||||||
'Conversation was not approved by user; rejecting call message.'
|
'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 { isDirectConversation, isMe } from './whatTypeOfConversation';
|
||||||
import { isInSystemContacts } from './isInSystemContacts';
|
import { isInSystemContacts } from './isInSystemContacts';
|
||||||
|
|
||||||
|
export type IsConversationAcceptedOptionsType = {
|
||||||
|
ignoreEmptyConvo: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if this conversation should be considered "accepted" in terms
|
* Determine if this conversation should be considered "accepted" in terms
|
||||||
* of message requests
|
* of message requests
|
||||||
*/
|
*/
|
||||||
export function isConversationAccepted(
|
export function isConversationAccepted(
|
||||||
conversationAttrs: ConversationAttributesType,
|
conversationAttrs: ConversationAttributesType,
|
||||||
{ ignoreEmptyConvo = false } = {}
|
{ ignoreEmptyConvo }: IsConversationAcceptedOptionsType = {
|
||||||
|
ignoreEmptyConvo: false,
|
||||||
|
}
|
||||||
): boolean {
|
): boolean {
|
||||||
if (isMe(conversationAttrs)) {
|
if (isMe(conversationAttrs)) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -36,6 +42,7 @@ export function isConversationAccepted(
|
||||||
(conversationAttrs.messageCountBeforeMessageRequests || 0) > 0;
|
(conversationAttrs.messageCountBeforeMessageRequests || 0) > 0;
|
||||||
const hasNoMessages = (conversationAttrs.messageCount || 0) === 0;
|
const hasNoMessages = (conversationAttrs.messageCount || 0) === 0;
|
||||||
|
|
||||||
|
// We don't want to show the message request UI in an empty conversation.
|
||||||
const isEmptyPrivateConvo =
|
const isEmptyPrivateConvo =
|
||||||
hasNoMessages &&
|
hasNoMessages &&
|
||||||
isDirectConversation(conversationAttrs) &&
|
isDirectConversation(conversationAttrs) &&
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue