@@ -111,8 +111,8 @@ export type RTCCallIntent = "audio" | "video" | string;
111111 * @returns a parsed IRTCNotificationContent
112112 */
113113export function parseCallNotificationContent ( content : IContent ) : IRTCNotificationContent {
114- if ( typeof content [ "m.mentions" ] !== "object" ) {
115- throw new Error ( "Missing m.mentions" ) ;
114+ if ( content [ "m.mentions" ] && typeof content [ "m.mentions" ] !== "object" ) {
115+ throw new Error ( "malformed m.mentions" ) ;
116116 }
117117 if ( typeof content [ "notification_type" ] !== "string" ) {
118118 throw new Error ( "Missing or invalid notification_type" ) ;
@@ -124,9 +124,6 @@ export function parseCallNotificationContent(content: IContent): IRTCNotificatio
124124 throw new Error ( "Missing or invalid lifetime" ) ;
125125 }
126126
127- if ( content [ "decline_reason" ] && typeof content [ "decline_reason" ] !== "string" ) {
128- throw new Error ( "Invalid decline_reason" ) ;
129- }
130127 if ( content [ "relation" ] && content [ "relation" ] [ "rel_type" ] !== "m.reference" ) {
131128 throw new Error ( "Invalid relation" ) ;
132129 }
@@ -143,8 +140,7 @@ export function parseCallNotificationContent(content: IContent): IRTCNotificatio
143140 * Don't cast event content to this directly. Use `parseCallNotificationContent` instead to validate the content first.
144141 */
145142export interface IRTCNotificationContent extends RelationEvent {
146- "m.mentions" : IMentions ;
147- "decline_reason" ?: string ;
143+ "m.mentions" ?: IMentions ;
148144 "notification_type" : RTCNotificationType ;
149145 /**
150146 * The initial intent of the calling user.
0 commit comments