oncall-engine/engine/apps
Vadim Stepanov 06bd0454f6
Fix MultipleObjectsReturned error on webhook endpoints (#1996)
# What this PR does
Sometimes `CustomButtonView` returns HTTP 500 with the following error:

```
apps.alerts.models.custom_button.CustomButton.MultipleObjectsReturned: get() returned more than one CustomButton -- it returned 3!
```

This PR fixes it by adding `.distinct()` to the `CustomButton` queryset
when retrieving an instance + does the same for `WebhooksView`.

## Which issue(s) this PR fixes
Related to https://github.com/grafana/oncall-private/issues/1828

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-05-23 16:23:06 +00:00
..
alerts Remove prints (#1924) 2023-05-15 09:28:01 +08:00
api Fix MultipleObjectsReturned error on webhook endpoints (#1996) 2023-05-23 16:23:06 +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 Fix documentation links (#1766) 2023-04-19 10:12:16 +01: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 Test mobile push (#1933) 2023-05-18 15:52:42 +08:00
oss_installation Add database migrations linter (#1020) 2023-02-06 16:01:37 +08:00
public_api Allow null for short description in integrations api (#1952) 2023-05-17 18:43:01 +08: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 Add database migrations linter (#1020) 2023-02-06 16:01:37 +08:00
user_management Fix organizations not being deleted by start_cleanup_deleted_organizations (#1950) 2023-05-17 12:56:57 +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