Skip to content
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-58455] Add error handling when FocusStatus is not authorized on macOS #3053

Merged
merged 3 commits into from
Jun 6, 2024

Conversation

devinbinnie
Copy link
Member

Summary

A recent change that allowed the macOS app to correctly use the FocusStatus to prevent notifications under DND was completely stopping notifications if permission wasn't given. This was caused by the app not performing any error handling from the DND check, which would throw an error if the app wasn't authorized to check the status.

This PR adds that error handling, and logs a warning in the logs to denote that the check failed.

Ticket Link

Closes #3052
https://mattermost.atlassian.net/browse/MM-58455

Fixed an issue where notifications would not show on macOS in certain cases.

@devinbinnie devinbinnie added the 2: Dev Review Requires review by a core committer label Jun 6, 2024
@devinbinnie
Copy link
Member Author

@amyblais I'm looking to do a dot release for this one if possible.

@amyblais
Copy link
Member

amyblais commented Jun 6, 2024

@amyblais I'm looking to do a dot release for this one if possible.

Ok 👍

@amyblais amyblais added this to the v5.8.0 milestone Jun 6, 2024
@amyblais amyblais added the CherryPick/Approved Meant for the quality or patch release tracked in the milestone label Jun 6, 2024
@@ -27,6 +27,11 @@ class NotificationManager {
private upgradeNotification?: NewVersionNotification;
private restartToUpgradeNotification?: UpgradeNotification;

constructor() {
// Run this very early to perform an early permission check
getDoNotDisturb();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this trigger a permission modal before getting a notification?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it shows the macOS one that people were missing.

@@ -27,6 +27,11 @@ class NotificationManager {
private upgradeNotification?: NewVersionNotification;
private restartToUpgradeNotification?: UpgradeNotification;

constructor() {
// Run this very early to perform an early permission check
getDoNotDisturb();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this happen as an explicit call from somewhere in the initialization code? It feels a bit weird to have this be a side effect of importing this file

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I guess that would be better, I wanted to keep everything centralized but the import case does make that a bit awkward.

@devinbinnie devinbinnie added 4: Reviews Complete All reviewers have approved the pull request and removed 2: Dev Review Requires review by a core committer labels Jun 6, 2024
@devinbinnie devinbinnie merged commit d11752e into master Jun 6, 2024
18 checks passed
@devinbinnie devinbinnie deleted the MM-58455 branch June 6, 2024 18:04
@mattermost-build
Copy link
Contributor

Cherry pick is scheduled.

mattermost-build pushed a commit that referenced this pull request Jun 6, 2024
…acOS (#3053)

* [MM-58455] Add error handling when FocusStatus is not authorized on macOS

* Do the permission check very early so that it's less likely for users to miss it

* Move permissions check to initialize

(cherry picked from commit d11752e)
@mattermost-build mattermost-build added CherryPick/Done Successfully cherry-picked to the quality or patch release tracked in the milestone and removed CherryPick/Approved Meant for the quality or patch release tracked in the milestone labels Jun 6, 2024
devinbinnie added a commit that referenced this pull request Jun 6, 2024
…acOS (#3053) (#3054)

* [MM-58455] Add error handling when FocusStatus is not authorized on macOS

* Do the permission check very early so that it's less likely for users to miss it

* Move permissions check to initialize

(cherry picked from commit d11752e)

Co-authored-by: Devin Binnie <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4: Reviews Complete All reviewers have approved the pull request CherryPick/Done Successfully cherry-picked to the quality or patch release tracked in the milestone release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Notification banners and sound are not played on macOS when FocusStatus permission is denied
6 participants