Ensure that notifications on legacy http integrations navigate to the origin #1349
+4,097
−4,869
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.
Ensure that notifications on legacy http integrations navigate to the origin
Details
There was an issue with legacy HTTP integrations where the defaultNotificationUrl was never saved in the DB. As the result if a notification was sent without explicit launch url, the service worker logic would default to the worker's scope which is in the os.tc domain. This in turn would redirect users to OneSignal dashboard rather than to the customer's site.
To account for missing default notification url, we try to get the default URL from the app config on notification click and save it to the DB for the future use. Choosing between notification received and clicked to add this logic, decided on notification clicked to avoid doing extra api call when the user may never click the notification.
Verified in Chrome, Firefox and Safari that when clicking on a notification it redirects to the origin instead of the os.tc domain.
Note: will only merge it after Thanksgiving
Systems Affected
Validation
Tests
There seem to be no tests for the service worker flows so didn't add any new ones 🤔 Did an extensive manual test in Chrome, Safari and Firefox.
Info
Checklist
Programming Checklist
Interfaces:
Functions:
Typescript:
Other:
elem of arraysyntax. PreferforEachor usemapcontextif possible. Instead, we can pass it to function/constructor so that we don't callOneSignal.contextScreenshots
Info
http.notification.click.fix.mov
Checklist
Related Tickets
https://app.asana.com/1/780103692902078/project/1211950939908862/task/1210115044974433?focus=true
This change is