diff --git a/engine/Dockerfile b/engine/Dockerfile index dcc0c1ea..15ff4503 100644 --- a/engine/Dockerfile +++ b/engine/Dockerfile @@ -20,7 +20,7 @@ COPY ./ ./ # Collect static files and create an SQLite database RUN mkdir -p /var/lib/oncall -RUN DJANGO_SETTINGS_MODULE=settings.prod_without_db DATABASE_TYPE=sqlite3 DATABASE_NAME=/var/lib/oncall/oncall.db SECRET_KEY="ThEmUsTSecretKEYforBUILDstage123" python manage.py collectstatic --no-input +RUN DJANGO_SETTINGS_MODULE=settings.prod_without_db DATABASE_TYPE=sqlite3 DATABASE_NAME=/var/lib/oncall/oncall.db SECRET_KEY="ThEmUsTSecretKEYforBUILDstage123" SILK_PROFILER_ENABLED="True" python manage.py collectstatic --no-input RUN chown -R 1000:2000 /var/lib/oncall FROM base AS dev diff --git a/engine/apps/api/views/alert_group.py b/engine/apps/api/views/alert_group.py index bff96381..17f6a9c8 100644 --- a/engine/apps/api/views/alert_group.py +++ b/engine/apps/api/views/alert_group.py @@ -206,8 +206,14 @@ class AlertGroupView( def get_queryset(self): # no select_related or prefetch_related is used at this point, it will be done on paginate_queryset. + alert_receive_channels_ids = list( + AlertReceiveChannel.objects.filter( + organization_id=self.request.auth.organization.id, + team_id=self.request.user.current_team, + ).values_list("id", flat=True) + ) queryset = AlertGroup.unarchived_objects.filter( - channel__organization=self.request.auth.organization, channel__team=self.request.user.current_team + channel_id__in=alert_receive_channels_ids, ).only("id") return queryset