-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
MM-55036 - Calls: Fix: Receiving in-app notifications for calls notifications while active #7623
Conversation
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.
Definitely not elengant but ok for the time being, I would definitely want us to go in the direction of the type of message in the near future, yes is more work but it does keep it cleaner and consistent even if we decide to chsnge the message.
My worry on this and perhaps cause idk the details, is, can the message of the notification be in a language different than english?
@enahum Yes, great point - we have a ticket for i18n to be completed for 1.0, so I've added ticket for typing the calls push notification: https://mattermost.atlassian.net/browse/MM-55060 |
Building app in separate branch. |
Could you help me understand what it would take to do this cleanly? |
@streamer45 An update: I'm working on it, but I'm hitting snags. We can chat in our 1:1. |
375a6ce
to
ba4af4e
Compare
Ok, fixed. With the following PRs, calls notifications will either be sent as |
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.
Thanks 💯
app/products/calls/utils.ts
Outdated
export function isCallsStartedMessage(message = '') { | ||
return (message === 'You\'ve been invited to a call' || callsMessageRegex.test(message)); | ||
} |
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.
Can we leave a comment to deprecate this at some point?
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.
Done in 13d1946
Please see: mattermost/mattermost#25405 (comment) |
@@ -14,6 +15,8 @@ import type PostModel from '@typings/database/models/servers/post'; | |||
import type {IntlShape} from 'react-intl'; | |||
import type {RTCIceServer} from 'react-native-webrtc'; | |||
|
|||
const callsMessageRegex = /^\u200b.* is inviting you to a call$/; |
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.
we should add a note here not to forget when the plugin starts to support localization
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 regex won't need to be changed when we support localization -- when we support localization it will be handled by the sub_type check. The regex will still be needed to match older messages from pre-0.21.0 calls (or pre-change MM server and pre-change proxy servers). When we finally remove that section of the code below, this can be removed (it will show up as dead-code and go will tell us).
Just in case, I added a note to the removal ticket https://mattermost.atlassian.net/browse/MM-55506
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.
Good stuff 👍
…ications while active (mattermost#7623) * when active, do not show overlay if this is a calls-started notification * add calls notification type; keep message test for backwards compat * process calls notifications properly * revert NOTIFICATION_TYPE.CALLS; use sub_type for backwards compatibility * add ticket and comment for future refactoring of isCallsStartedMessage
…ications while active (mattermost#7623) * when active, do not show overlay if this is a calls-started notification * add calls notification type; keep message test for backwards compat * process calls notifications properly * revert NOTIFICATION_TYPE.CALLS; use sub_type for backwards compatibility * add ticket and comment for future refactoring of isCallsStartedMessage
Summary
NOTE: we are testing on the exact message sent by the calls plugin.This is not elegant, I agree. We could add a newNOTIFICATION_TYPE.CALLS
(which would require changes across the products). That would certainly be more "correct." But on the other hand: the current solution won't break because there's no other way for the existing products to accidentally send those exact messages. The only way would be for the product or a plugin to explicitly send them, and if they do that then they could just as easily send aNOTIFICATION_TYPE.CALLS
too.Ticket Link
Checklist
Device Information
Release Note