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

address mobile device push notification delivery issue when user had > 1 registered device #2421

Merged
merged 3 commits into from
Jul 5, 2023

Conversation

joeyorlando
Copy link
Contributor

What this PR does

Address issue where if the user had multiple registered devices w/ FCM, doing django queries like .first() could potentially pick the wrong device. Do this in two ways:

  1. set the DELETE_INACTIVE_DEVICES fcm_django setting to True. According to the docs, this works as follows:

    devices to which notifications cannot be sent, are deleted upon receiving error response from FCM

  2. Customizing the FCMDevice model provided by fcm_django. Add a new method, get_active_device_for_user, so that we can centralize the logic for this rather than duplicating FCMDevice.objects.filter(user=user).first()

Which issue(s) this PR fixes

https://raintank-corp.slack.com/archives/C0229FD3CE9/p1688461915752119

Checklist

  • Unit, integration, and e2e (if applicable) tests updated
  • Documentation added (or pr:no public docs PR label added if not required) (N/A)
  • CHANGELOG.md updated (or pr:no changelog PR label added if not required)

@joeyorlando joeyorlando added the pr:no public docs Added to a PR that does not require public documentation updates label Jul 4, 2023
@joeyorlando joeyorlando requested a review from a team July 4, 2023 10:19
@joeyorlando joeyorlando self-assigned this Jul 4, 2023
@iskhakov
Copy link
Contributor

iskhakov commented Jul 5, 2023

great job, approved

@joeyorlando joeyorlando force-pushed the jorlando/delete-inactive-registered-mobile-devices branch from 4f3aa5a to d7a6f45 Compare July 5, 2023 14:59
@joeyorlando joeyorlando enabled auto-merge July 5, 2023 14:59
@joeyorlando joeyorlando added this pull request to the merge queue Jul 5, 2023
Merged via the queue into dev with commit 425ffbb Jul 5, 2023
@joeyorlando joeyorlando deleted the jorlando/delete-inactive-registered-mobile-devices branch July 5, 2023 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:no public docs Added to a PR that does not require public documentation updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants