oncall-engine/engine
Vadim Stepanov 6b87ad74e9
Enforce cloud connection to send push notifications on OSS (#1132)
This PR modifies how OSS instances send mobile app push notifications.
It also adds frontend warnings when user is trying to use the mobile app
without connecting to cloud.

- [x] Add public API authentication to `FCMRelayView` and throttle the
view to 300 push notifications per instance per minute. This is similar
to how SMS and phone call notifications work on OSS instances.
- [x] Add frontend warnings based on cloud connectivity
- [x] Fix/add frontend tests
- [x] Add tests for FCMRelayView and mobile app backend

## Screenshots

When a user tries to connect the mobile app in his settings and cloud is
not connected (clicking "Connect Cloud OnCall" redirects to the "Cloud"
tab):

<img width="1088" alt="Screenshot 2023-01-12 at 18 48 58"
src="https://user-images.githubusercontent.com/20116910/212156591-86906020-eddf-43f1-9402-7ebb7547c7e6.png">

When a user tries to use mobile push notifications as a personal
notification step and cloud is not connected:

<img width="764" alt="Screenshot 2023-01-12 at 19 01 10"
src="https://user-images.githubusercontent.com/20116910/212157580-9abb0758-79ad-4316-b8cd-15b4fff01502.png">

Now on the "Cloud" tab there's some info about the mobile app (the last
section at the bottom of the page):

<img width="1245" alt="Screenshot 2023-01-12 at 18 49 10"
src="https://user-images.githubusercontent.com/20116910/212156997-c8b70dd5-bf15-4bc7-8eb8-9decdb8ecc80.png">

After connecting to the cloud instance, everything goes back to active
and it's now possible to connect the mobile app:

<img width="1091" alt="Screenshot 2023-01-12 at 19 08 27"
src="https://user-images.githubusercontent.com/20116910/212158811-60d49888-4714-4c0e-850f-3ff6a11a117a.png">

After connecting the app the warning is gone:

<img width="764" alt="Screenshot 2023-01-12 at 19 07 00"
src="https://user-images.githubusercontent.com/20116910/212158614-677ab889-127f-4d64-bacc-0c26887f3097.png">
2023-01-19 11:15:56 +00:00
..
apps Enforce cloud connection to send push notifications on OSS (#1132) 2023-01-19 11:15:56 +00:00
common Introduce org uuid (#947) 2022-12-06 22:42:58 +08:00
config_integrations Add escalation chain option when creating a direct page alert group (#1143) 2023-01-18 12:58:26 -03:00
engine Remove local uwsgi instrumentation and local development tempo and agent 2023-01-04 22:25:17 +08:00
settings Add escalation chain option when creating a direct page alert group (#1143) 2023-01-18 12:58:26 -03:00
static/images World, meet OnCall! 2022-06-03 08:09:47 -06:00
.dockerignore One startup command to rule them all (#760) 2022-11-07 16:34:43 +01:00
.gitignore modify push notification settings + use fcm-django library (#998) 2022-12-20 12:41:34 +01:00
celery_with_exporter.sh Add flag to debug logs (#912) 2022-11-29 11:16:42 +08:00
conftest.py Enforce cloud connection to send push notifications on OSS (#1132) 2023-01-19 11:15:56 +00:00
Dockerfile swap psycopg2-binary to psycopg2 in requirements.txt (#1062) 2023-01-03 13:47:03 +01:00
manage.py World, meet OnCall! 2022-06-03 08:09:47 -06:00
pyproject.toml World, meet OnCall! 2022-06-03 08:09:47 -06:00
requirements.txt Remove local uwsgi instrumentation and local development tempo and agent 2023-01-04 22:25:17 +08:00
tox.ini Add RBAC Support (#777) 2022-11-29 09:41:56 +01:00
uwsgi.ini Update uwsgi.ini 2022-06-15 19:13:50 +03:00
wait_for_test_mysql_start.sh World, meet OnCall! 2022-06-03 08:09:47 -06:00