Fix integrations options order (#2204)

# What this PR does

## Which issue(s) this PR fixes

## 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)
This commit is contained in:
Ildar Iskhakov 2023-06-14 09:33:52 +08:00 committed by GitHub
parent 072d43c3d2
commit 952df67580
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -187,6 +187,7 @@ class AlertReceiveChannelView(
@action(detail=False, methods=["get"])
def integration_options(self, request):
choices = []
featured_choices = []
for integration_id, integration_title in AlertReceiveChannel.INTEGRATION_CHOICES:
if integration_id in AlertReceiveChannel.WEB_INTEGRATION_CHOICES:
choice = {
@ -200,10 +201,10 @@ class AlertReceiveChannelView(
}
# if integration is featured we show it in the beginning
if choice["featured"]:
choices = [choice] + choices
featured_choices.append(choice)
else:
choices.append(choice)
return Response(choices)
return Response(featured_choices + choices)
@action(detail=True, methods=["put"])
def change_team(self, request, pk):