diff --git a/ts/components/conversation/SessionMessagesList.tsx b/ts/components/conversation/SessionMessagesList.tsx
index 4b1c79bf4..00b777a00 100644
--- a/ts/components/conversation/SessionMessagesList.tsx
+++ b/ts/components/conversation/SessionMessagesList.tsx
@@ -21,7 +21,7 @@ import { SessionLastSeenIndicator } from './SessionLastSeenIndicator';
import { TimerNotification } from './TimerNotification';
import { DataExtractionNotification } from './message/message-item/DataExtractionNotification';
import { InteractionNotification } from './message/message-item/InteractionNotification';
-import { PropsForCallNotification, PropsForInteractionNotification } from '../../state/ducks/types';
+import { PropsForInteractionNotification } from '../../state/ducks/types';
function isNotTextboxEvent(e: KeyboardEvent) {
return (e?.target as any)?.type === undefined;
@@ -144,9 +144,7 @@ export const SessionMessagesList = (props: {
}
if (messageProps.message?.messageType === 'call-notification') {
- const msgProps = messageProps.message.props as PropsForCallNotification;
-
- return [, ...componentToMerge];
+ return [, ...componentToMerge];
}
if (messageProps.message?.messageType === 'interaction-notification') {
diff --git a/ts/components/conversation/message/message-item/notification-bubble/CallNotification.tsx b/ts/components/conversation/message/message-item/notification-bubble/CallNotification.tsx
index bc624d625..71b993c62 100644
--- a/ts/components/conversation/message/message-item/notification-bubble/CallNotification.tsx
+++ b/ts/components/conversation/message/message-item/notification-bubble/CallNotification.tsx
@@ -1,4 +1,4 @@
-import { CallNotificationType, PropsForCallNotification } from '../../../../../state/ducks/types';
+import { CallNotificationType } from '../../../../../state/ducks/types';
import { useSelectedNicknameOrProfileNameOrShortenedPubkey } from '../../../../../state/selectors/selectedConversation';
import { SessionIconType } from '../../../../icon';
@@ -6,6 +6,8 @@ import { ExpirableReadableMessage } from '../ExpirableReadableMessage';
import { NotificationBubble } from './NotificationBubble';
import { Localizer } from '../../../../basic/Localizer';
import { MergedLocalizerTokens } from '../../../../../localization/localeTools';
+import type { WithMessageId } from '../../../../../session/types/with';
+import { useMessageCallNotificationType } from '../../../../../state/selectors';
type StyleType = Record<
CallNotificationType,
@@ -30,11 +32,17 @@ const style = {
},
} satisfies StyleType;
-export const CallNotification = (props: PropsForCallNotification) => {
- const { messageId, notificationType } = props;
+export const CallNotification = (props: WithMessageId) => {
+ const { messageId } = props;
+
+ const notificationType = useMessageCallNotificationType(messageId);
const name = useSelectedNicknameOrProfileNameOrShortenedPubkey() ?? window.i18n('unknown');
+ if (!notificationType) {
+ return null;
+ }
+
const { iconColor, iconType, notificationTextKey } = style[notificationType];
return (
diff --git a/ts/models/conversation.ts b/ts/models/conversation.ts
index 498e9243a..06ed0e844 100644
--- a/ts/models/conversation.ts
+++ b/ts/models/conversation.ts
@@ -753,9 +753,7 @@ export class ConversationModel extends Backbone.Model {
public async addOutgoingApprovalMessage(timestamp: number) {
await this.addSingleOutgoingMessage({
sent_at: timestamp,
- messageRequestResponse: {
- isApproved: 1,
- },
+ messageRequestResponse: {},
expireTimer: 0,
});
@@ -771,9 +769,7 @@ export class ConversationModel extends Backbone.Model {
await this.addSingleIncomingMessage({
sent_at: timestamp,
source,
- messageRequestResponse: {
- isApproved: 1,
- },
+ messageRequestResponse: {},
unread: READ_MESSAGE_STATE.unread, // 1 means unread
expireTimer: 0,
});
diff --git a/ts/models/message.ts b/ts/models/message.ts
index f34d28ca2..5b34dc593 100644
--- a/ts/models/message.ts
+++ b/ts/models/message.ts
@@ -227,7 +227,7 @@ export class MessageModel extends Backbone.Model {
return this.get('groupInvitation');
}
- public isMessageRequestResponse() {
+ private isMessageRequestResponse() {
return !!this.get('messageRequestResponse');
}
diff --git a/ts/models/messageType.ts b/ts/models/messageType.ts
index 2097560cf..31bf981e1 100644
--- a/ts/models/messageType.ts
+++ b/ts/models/messageType.ts
@@ -194,8 +194,8 @@ export interface MessageAttributesOptionals {
hasVisualMediaAttachments?: boolean;
dataExtractionNotification?: DataExtractionNotificationMsg;
messageRequestResponse?: {
- /** 1 means approved, 0 means unapproved. */
- isApproved?: number;
+ // keeping it as a object in case we ever add a field here.
+ // Note: we had isApproved field, but it was unused so I got rid of it
};
unread?: number;
group?: any;
diff --git a/ts/receiver/contentMessage.ts b/ts/receiver/contentMessage.ts
index e5f10a8ed..0a063f217 100644
--- a/ts/receiver/contentMessage.ts
+++ b/ts/receiver/contentMessage.ts
@@ -793,6 +793,7 @@ async function handleMessageRequestResponse(
envelope: EnvelopePlus,
messageRequestResponse: SignalService.MessageRequestResponse
) {
+ // no one cares about the is `messageRequestResponse.isApproved` field currently.
if (!messageRequestResponse || !messageRequestResponse.isApproved) {
window?.log?.error('handleMessageRequestResponse: Invalid parameters -- dropping message.');
await IncomingMessageCache.removeFromCache(envelope);
diff --git a/ts/state/selectors/messages.ts b/ts/state/selectors/messages.ts
index 1fe44b3ce..6727685bd 100644
--- a/ts/state/selectors/messages.ts
+++ b/ts/state/selectors/messages.ts
@@ -204,3 +204,15 @@ export function useMessageCommunityInvitationCommunityName(messageId: string) {
return useMessagePropsByMessageId(messageId)?.propsForGroupInvitation?.serverName;
}
+/**
+ * =========================================
+ * Below are selectors for call notification
+ * =========================================
+ */
+
+/**
+ * Return the call notification type linked to the specified message
+ */
+export function useMessageCallNotificationType(messageId: string) {
+ return useMessagePropsByMessageId(messageId)?.propsForCallNotification?.notificationType;
+}