Repository navigation
fix(notifications): a browser removed in Puter stays off, and status() checks with Puter - #4458
Merged
Merged
Conversation
…) checks with Puter on websites
Contributor
Coverage Report for puter.js SDK
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On a website, a browser the user removed in Puter's settings re-registered itself on the next page load, and
status()kept saying'on'after the user removed the browser or turned the app off, because it only looked at browser state.push_device_removed, the page ends this browser's subscription locally and records pushes as off. It logs nothing, and later loads don't try again.enable(): onpush_device_removed, at the register or the verify step, it drops the old subscription, subscribes again and registers the new one, once. The on-load sync never renews. Renewal is skipped once adisable()has aborted the enable. The Puter desktop goes through the sameenable().status(): when the local answer would be'on'(website or GUI), it asksPOST /push/web/subscriptions/status.removeddrops the subscription and returns'off'.revokedrecords the opt-in as off and returns'off', andenable()still rejects withpush_revoked.activeandunknownreturn'on'. Any failure, including a server without the route, falls back to'on'. The check never opens a sign-in.status,removeDevice,enable,onPushand the push guide are updated.Tests: 19 new tests across
webPush.test.jsandnotifications.test.js, with 184 notification tests passing.check:puterjs:typesis clean.