-
-
Notifications
You must be signed in to change notification settings - Fork 641
Add parseCallNotificationContent #5015
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
Signed-off-by: Timo K <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable, can we get some tests, specifically on the cap value
Signed-off-by: Timo K <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some questions
src/matrixrtc/types.ts
Outdated
* @returns a parsed IRTCNotificationContent | ||
*/ | ||
export function parseCallNotificationContent(content: IContent): IRTCNotificationContent { | ||
if (!content["m.mentions"]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this is expected to at least be an empty [] array? cannot be skipped? I think ruma skips it if it is not set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it also might already do checks on this in the notifier. Lets only check for it to be an obj here.
src/matrixrtc/types.ts
Outdated
throw new Error("Missing or invalid lifetime"); | ||
} | ||
|
||
if (content["decline_reason"] && typeof content["decline_reason"] !== "string") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is new to me, a decline_reason in a RTCNotificationContent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right this is legacy... Not there anymore. its from the time where we used the notification event as the decline as well. This should have been done in the PR that added the decline event type...
Signed-off-by: Timo K <[email protected]>
We need a way to cap the lifetime of the m.rtc.notification event. It makes sense to combine this with a method that also validates all the fields of the event.
parseCallNotificationContent
does the validation and tha cap.Signed-off-by: Timo K [email protected]
Checklist
public
/exported
symbols have accurate TSDoc documentation.