oncall-engine/engine/apps
Joey Orlando 2e79c2301d
fix import issue which affected going oncall push notification (#2009)
# Which issue(s) this PR fixes
when running the mobile app (emulator) + OnCall locally and trying to
trigger "You're Going OnCall" push notifications, I was seeing this in
the `celery` logs:
```bash
2023-05-24 21:39:54,032 source=engine:celery worker=ForkPoolWorker-3 task_id=cf9e5b52-a213-430a-8e3c-d6c3bed53318 task_name=apps.mobile_app.tasks.conditionally_send_going_oncall_push_notifications_for_schedule name=celery.app.trace level=INFO Task apps.mobile_app.tasks.conditionally_send_going_oncall_push_notifications_for_schedule[cf9e5b52-a213-430a-8e3c-d6c3bed53318] retry: Retry in 2s: NameError("name 'MobileAppUserSettings' is not defined")
```

This PR patches that by adding the import (inside the relevant function,
to avoid circular imports). After adding this import, I am seeing push
notifications being sent successfully:
```bash
2023-05-24 21:44:08,910 source=engine:celery worker=ForkPoolWorker-3 task_id=71a708b5-9982-4b71-b719-17ed5867dfe1 task_name=apps.mobile_app.tasks.conditionally_send_going_oncall_push_notifications_for_schedule name=apps.mobile_app.tasks level=INFO Evaluating if we should send push notification for schedule 1 for user UWZ6FR5T2KG7U
2023-05-24 21:44:08,912 source=engine:celery worker=ForkPoolWorker-3 task_id=71a708b5-9982-4b71-b719-17ed5867dfe1 task_name=apps.mobile_app.tasks.conditionally_send_going_oncall_push_notifications_for_schedule name=apps.mobile_app.tasks level=INFO timing is right to send going oncall push notification
seconds_until_shift_starts: 476
user_notification_timing_preference: 43200
timing_window_lower: 42780
timing_window_upper: 43620
shift_starts_within_users_notification_timing_preference: False
shift_starts_within_fifteen_minutes: True
2023-05-24 21:44:08,916 source=engine:celery worker=ForkPoolWorker-3 task_id=71a708b5-9982-4b71-b719-17ed5867dfe1 task_name=apps.mobile_app.tasks.conditionally_send_going_oncall_push_notifications_for_schedule name=apps.mobile_app.tasks level=DEBUG Sending push notification with message: {"android": {"priority": "high"}, "apns": {"headers": {"apns-priority": "10"}, "payload": {"aps": {"alert": {"title": "You are going on call in 7 minutes for schedule joey test"}, "interruption-level": "time-sensitive", "sound": {"name": "default_sound.aiff"}, "thread-id": "SZM7GDPI2VI3F:UWZ6FR5T2KG7U:going-oncall"}}}, "data": {"info_notification_sound_name": "default_sound.mp3", "info_notification_volume": "0.8", "info_notification_volume_override": "false", "info_notification_volume_type": "constant", "thread_id": "SZM7GDPI2VI3F:UWZ6FR5T2KG7U:going-oncall", "title": "You are going on call in 7 minutes for schedule joey test", "type": "oncall.info"}, "token": "dqWWqPS8SvOno1TEE_ZBlX:APA91bHW3hB2sXfKHxxrZ6BITyju3gzBfOHyh1drqndc1U8_b-F89JIfPEsaZvXL-uQd0vpJA8LHifEUCZKb_frk-wbTAwbgk92_0a1DvUKdgNcntK-O85MUDRuf6bWhE9NRGIv58tt5"}
```

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-05-24 17:56:20 -04:00
..
alerts Phone provider refactoring (#1713) 2023-05-24 06:27:48 +00:00
api Phone provider refactoring (#1713) 2023-05-24 06:27:48 +00:00
api_for_grafana_incident Include alert details in Grafana Incident alert-group endpoint (#1280) 2023-02-03 13:43:21 +00:00
auth_token Improve plugin authentication (#1995) 2023-05-23 16:13:25 +00:00
base Phone provider refactoring (#1713) 2023-05-24 06:27:48 +00:00
email Fix inbound email bug when attaching files (#1970) 2023-05-18 17:35:36 +00:00
grafana_plugin Improve plugin authentication (#1995) 2023-05-23 16:13:25 +00:00
heartbeat Add database migrations linter (#1020) 2023-02-06 16:01:37 +08:00
integrations Add docs & logo for AppDynamics integration (#1916) 2023-05-11 16:41:51 +00:00
mobile_app fix import issue which affected going oncall push notification (#2009) 2023-05-24 17:56:20 -04:00
oss_installation Add database migrations linter (#1020) 2023-02-06 16:01:37 +08:00
phone_notifications Phone provider refactoring (#1713) 2023-05-24 06:27:48 +00:00
public_api Phone provider refactoring (#1713) 2023-05-24 06:27:48 +00:00
schedules Refactor upcoming shifts to use cached final schedule data (#1891) 2023-05-08 19:01:24 +00:00
slack Slack: use user_profile_changed event instead of user_change (#1938) 2023-05-15 16:32:06 +00:00
social_auth Fix insight_logs exceptions (#1757) 2023-04-17 07:16:18 +00:00
telegram Fix SQLite permission issue (#1984) 2023-05-22 19:16:31 +00:00
twilioapp Correct flags of twilio phone provider 2023-05-24 19:18:09 +08:00
user_management Phone provider refactoring (#1713) 2023-05-24 06:27:48 +00:00
webhooks Webhook response check content length instead of header for length limit (#1900) 2023-05-09 13:55:05 +00:00
__init__.py World, meet OnCall! 2022-06-03 08:09:47 -06:00