From 952df67580facce3456e8fb1bee2f19affb37987 Mon Sep 17 00:00:00 2001 From: Ildar Iskhakov Date: Wed, 14 Jun 2023 09:33:52 +0800 Subject: [PATCH] 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) --- engine/apps/api/views/alert_receive_channel.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engine/apps/api/views/alert_receive_channel.py b/engine/apps/api/views/alert_receive_channel.py index eefec126..a0fff6ad 100644 --- a/engine/apps/api/views/alert_receive_channel.py +++ b/engine/apps/api/views/alert_receive_channel.py @@ -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):