oncall-engine/engine/apps/mobile_app
Joey Orlando 425ffbb740
address mobile device push notification delivery issue when user had > 1 registered device (#2421)
# 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](20e275618b/README.rst (L127-L130)),
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

- [x] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required) (N/A)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-07-05 15:14:46 +00:00
..
migrations add user locale field to mobile app user settings table + change going on call push notification text (#2131) 2023-06-14 12:19:58 -04:00
tests address mobile device push notification delivery issue when user had > 1 registered device (#2421) 2023-07-05 15:14:46 +00:00
__init__.py Mobile app messaging backend (#874) 2022-11-23 15:56:43 +00:00
alert_rendering.py Fix warnings when running backend tests (#2079) 2023-06-06 18:38:00 +00:00
auth.py Add organization moved exception to mobile app auth (#2422) 2023-07-05 06:11:56 +00:00
backend.py address mobile device push notification delivery issue when user had > 1 registered device (#2421) 2023-07-05 15:14:46 +00:00
demo_push.py address mobile device push notification delivery issue when user had > 1 registered device (#2421) 2023-07-05 15:14:46 +00:00
exceptions.py Test mobile push (#1933) 2023-05-18 15:52:42 +08:00
fcm_relay.py address mobile device push notification delivery issue when user had > 1 registered device (#2421) 2023-07-05 15:14:46 +00:00
models.py address mobile device push notification delivery issue when user had > 1 registered device (#2421) 2023-07-05 15:14:46 +00:00
serializers.py add user locale field to mobile app user settings table + change going on call push notification text (#2131) 2023-06-14 12:19:58 -04:00
tasks.py address mobile device push notification delivery issue when user had > 1 registered device (#2421) 2023-07-05 15:14:46 +00:00
urls.py Mobile app settings backend (#1571) 2023-03-22 14:47:18 +00:00
views.py Mobile app settings backend (#1571) 2023-03-22 14:47:18 +00:00