oncall-engine/engine/apps/api
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
..
permissions Add "Notifications Receiver" RBAC role (#1853) 2023-05-02 12:19:34 +00:00
serializers Allow null for short description in integrations api (#1952) 2023-05-17 18:43:01 +08:00
tests Refactor upcoming shifts to use cached final schedule data (#1891) 2023-05-08 19:01:24 +00:00
throttlers Test mobile push (#1933) 2023-05-18 15:52:42 +08:00
views Fix MultipleObjectsReturned error on webhook endpoints (#1996) 2023-05-23 16:23:06 +00:00
__init__.py World, meet OnCall! 2022-06-03 08:09:47 -06:00
response_renderers.py World, meet OnCall! 2022-06-03 08:09:47 -06:00
urls.py Add initial webhooks internal plugin API (#1524) 2023-03-10 17:00:06 +00:00