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

[Fix] Add OneSignal-Subscription-Id header to create user requests #1161

Merged
merged 5 commits into from
Mar 6, 2024

Conversation

shepherd-l
Copy link
Contributor

@shepherd-l shepherd-l commented Mar 5, 2024

Description

1 Line Summary

Adds OneSignal-Subscription-Id header to create user requests

Details

  • Adds OneSignal-Subscription-Id and refresh_device_metadtat: true header to user create requests
  • Adds OneSignal-Subscription-Id header to all user update requests
    • Previously the header was only added to session related requests

Systems Affected

  • WebSDK
  • Backend
  • Dashboard

Validation

Tests

Info

Added unit tests for refresh_device_metadata and OneSignal-Subscription-Id for create user and OneSignal-Subscription-Id for update user.
Manually tested on the OneSignal WebSDK Sandbox: Create user requests from login to an identified user from an identified user (OneSignal-Subscription-Id and refresh_device_metadata sent) and fresh install (no OneSignal-Subscription-Id). Update user requests from adding tags (OneSignal-Subscription-Id sent).

Checklist

  • All the automated tests pass or I explained why that is not possible
  • I have personally tested this on my machine or explained why that is not possible
  • I have included test coverage for these changes or explained why they are not needed

Programming Checklist
Interfaces:

  • Don't use default export
  • New interfaces are in model files

Functions:

  • Don't use default export
  • All function signatures have return types
  • Helpers should not access any data but rather be given the data to operate on.

Typescript:

  • No Typescript warnings
  • Avoid silencing null/undefined warnings with the exclamation point

Other:

  • Iteration: refrain from using elem of array syntax. Prefer forEach or use map
  • Avoid using global OneSignal accessor for context if possible. Instead, we can pass it to function/constructor so that we don't call OneSignal.context

Screenshots

Info

Checklist

  • I have included screenshots/recordings of the intended results or explained why they are not needed

Related Tickets



This change is Reviewable

Added OneSignal-Subscription-Id header and refresh_device_metadata
Pass up subscriptionId to use for OneSignal-Subscription-Id header in the create and update user calls
Makes it easier to make unit tests for create user with refresh_device_metadata
Fixes the OneSignal-Subscription-Id header being undefined on login from an identified user to another identified user. The pushSubscription model at this point in time is undefined and has no id. Now the subscription id will be passed up from login in the same fashion as identify user.
Adds OneSignal-Subscription-Id header unit test for create and update user requests. Also adds refresh_device_metadata test for create user
@shepherd-l shepherd-l requested a review from jkasten2 March 5, 2024 17:53
@shepherd-l shepherd-l merged commit d3d7736 into main Mar 6, 2024
4 checks passed
@shepherd-l shepherd-l deleted the fix/CreateUserHeader branch March 6, 2024 20:17
@jkasten2 jkasten2 mentioned this pull request Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants