Repository: PostHog/posthog
Pull request #30032: fix: dont enable surveys automatically
Author: login: lucasheriques
Labels: name: feature/surveys
Created: 2025-03-17T17:46:34Z | Merged: 2025-03-18T14:30:36Z

## Problem

if surveys are disabled on a project level, we shouldn't go and re-enable for customers automatically. let's keep this setting explicit.

[more context](https://github.com/PostHog/posthog/pull/29637#discussion_r1998151276)

## Changes

removes the `update_surveys_opt_in` post save flag for surveys.

some copy improvements

<!-- If there are frontend changes, please include screenshots. -->
<!-- If a reference design was involved, include a link to the relevant Figma frame! -->

👉 _Stay up-to-date with [PostHog coding conventions](https://posthog.com/docs/contribute/coding-conventions) for a smoother review._

## Does this work well for both Cloud and self-hosted?

yes

## How did you test this code?

verified the opt in is no longer updating after launching a survey



Diff:
diff --git a/frontend/__snapshots__/scenes-app-surveys--surveys-list--dark.png b/frontend/__snapshots__/scenes-app-surveys--surveys-list--dark.png
index 539a1c50aeb5..6b77ba170649 100644
Binary files a/frontend/__snapshots__/scenes-app-surveys--surveys-list--dark.png and b/frontend/__snapshots__/scenes-app-surveys--surveys-list--dark.png differ
diff --git a/frontend/__snapshots__/scenes-app-surveys--surveys-list--light.png b/frontend/__snapshots__/scenes-app-surveys--surveys-list--light.png
index be4410e84d09..9aae0bcf6109 100644
Binary files a/frontend/__snapshots__/scenes-app-surveys--surveys-list--light.png and b/frontend/__snapshots__/scenes-app-surveys--surveys-list--light.png differ
diff --git a/frontend/src/scenes/surveys/Surveys.tsx b/frontend/src/scenes/surveys/Surveys.tsx
index 1297da1a53c9..ac9225ddbb2b 100644
--- a/frontend/src/scenes/surveys/Surveys.tsx
+++ b/frontend/src/scenes/surveys/Surveys.tsx
@@ -162,8 +162,8 @@ export function Surveys(): JSX.Element {
                                 }}
                                 className="mb-2"
                             >
-                                Survey popovers are currently disabled for this {settingLevel} but there are active
-                                surveys running. Re-enable them in the settings.
+                                Survey popovers are currently disabled for this {settingLevel}. Re-enable them in the
+                                settings, otherwise surveys will not be visible.
                             </LemonBanner>
                         ) : null}
                     </div>
diff --git a/frontend/src/scenes/surveys/surveysLogic.tsx b/frontend/src/scenes/surveys/surveysLogic.tsx
index dec917d93b0f..aef38508421b 100644
--- a/frontend/src/scenes/surveys/surveysLogic.tsx
+++ b/frontend/src/scenes/surveys/surveysLogic.tsx
@@ -11,7 +11,7 @@ import { urls } from 'scenes/urls'
 import { userLogic } from 'scenes/userLogic'
 
 import { activationLogic, ActivationTask } from '~/layout/navigation-3000/sidepanel/panels/activation/activationLogic'
-import { AvailableFeature, Breadcrumb, ProgressStatus, Survey, SurveyType } from '~/types'
+import { AvailableFeature, Breadcrumb, ProgressStatus, Survey } from '~/types'
 
 import type { surveysLogicType } from './surveysLogicType'
 
@@ -338,14 +338,9 @@ export const surveysLogic = kea<surveysLogicType>([
                 hasAvailableFeature(AvailableFeature.SURVEYS_ACTIONS),
         ],
         showSurveysDisabledBanner: [
-            (s) => [s.currentTeam, s.currentTeamLoading, s.data],
-            (currentTeam, currentTeamLoading, data) => {
-                return (
-                    !currentTeamLoading &&
-                    currentTeam &&
-                    !currentTeam.surveys_opt_in &&
-                    data.surveys.some((s: Survey) => s.start_date && !s.end_date && s.type !== SurveyType.API)
-                )
+            (s) => [s.currentTeam],
+            (currentTeam) => {
+                return currentTeam?.surveys_opt_in === false
             },
         ],
     }),
diff --git a/posthog/api/test/__snapshots__/test_survey.ambr b/posthog/api/test/__snapshots__/test_survey.ambr
index cc77c578d30d..6957be3057c8 100644
--- a/posthog/api/test/__snapshots__/test_survey.ambr
+++ b/posthog/api/test/__snapshots__/test_survey.ambr
@@ -24,18 +24,6 @@
   '''
 # ---
 # name: TestSurveysAPIList.test_list_surveys
-  '''
-  SELECT COUNT(*) AS "__count"
-  FROM "posthog_survey"
-  INNER JOIN "posthog_team" ON ("posthog_survey"."team_id" = "posthog_team"."id")
-  WHERE (NOT "posthog_survey"."archived"
-         AND "posthog_survey"."end_date" IS NULL
-         AND "posthog_survey"."start_date" IS NOT NULL
-         AND "posthog_team"."project_id" = 99999
-         AND NOT ("posthog_survey"."type" = 'api'))
-  '''
-# ---
-# name: TestSurveysAPIList.test_list_surveys.1
   '''
   SELECT "posthog_team"."id",
          "posthog_team"."uuid",
@@ -106,78 +94,19 @@
   LIMIT 21
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.10
+# name: TestSurveysAPIList.test_list_surveys.1
   '''
-  SELECT "posthog_team"."id",
-         "posthog_team"."uuid",
-         "posthog_team"."organization_id",
-         "posthog_team"."project_id",
-         "posthog_team"."api_token",
-         "posthog_team"."app_urls",
-         "posthog_team"."name",
-         "posthog_team"."slack_incoming_webhook",
-         "posthog_team"."created_at",
-         "posthog_team"."updated_at",
-         "posthog_team"."anonymize_ips",
-         "posthog_team"."completed_snippet_onboarding",
-         "posthog_team"."has_completed_onboarding_for",
-         "posthog_team"."onboarding_tasks",
-         "posthog_team"."ingested_event",
-         "posthog_team"."autocapture_opt_out",
-         "posthog_team"."autocapture_web_vitals_opt_in",
-         "posthog_team"."autocapture_web_vitals_allowed_metrics",
-         "posthog_team"."autocapture_exceptions_opt_in",
-         "posthog_team"."autocapture_exceptions_errors_to_ignore",
-         "posthog_team"."person_processing_opt_out",
-         "posthog_team"."session_recording_opt_in",
-         "posthog_team"."session_recording_sample_rate",
-         "posthog_team"."session_recording_minimum_duration_milliseconds",
-         "posthog_team"."session_recording_linked_flag",
-         "posthog_team"."session_recording_network_payload_capture_config",
-         "posthog_team"."session_recording_masking_config",
-         "posthog_team"."session_recording_url_trigger_config",
-         "posthog_team"."session_recording_url_blocklist_config",
-         "posthog_team"."session_recording_event_trigger_config",
-         "posthog_team"."session_replay_config",
-         "posthog_team"."survey_config",
-         "posthog_team"."capture_console_log_opt_in",
-         "posthog_team"."capture_performance_opt_in",
-         "posthog_team"."capture_dead_clicks",
-         "posthog_team"."surveys_opt_in",
-         "posthog_team"."heatmaps_opt_in",
-         "posthog_team"."flags_persistence_default",
-         "posthog_team"."session_recording_version",
-         "posthog_team"."signup_token",
-         "posthog_team"."is_demo",
-         "posthog_team"."access_control",
-         "posthog_team"."week_start_day",
-         "posthog_team"."inject_web_apps",
-         "posthog_team"."test_account_filters",
-         "posthog_team"."test_account_filters_default_checked",
-         "posthog_team"."path_cleaning_filters",
-         "posthog_team"."timezone",
-         "posthog_team"."data_attributes",
-         "posthog_team"."person_display_name_properties",
-         "posthog_team"."live_events_columns",
-         "posthog_team"."recording_domains",
-         "posthog_team"."human_friendly_comparison_periods",
-         "posthog_team"."cookieless_server_hash_mode",
-         "posthog_team"."revenue_tracking_config",
-         "posthog_team"."primary_dashboard_id",
-         "posthog_team"."default_data_theme",
-         "posthog_team"."extra_settings",
-         "posthog_team"."modifiers",
-         "posthog_team"."correlation_config",
-         "posthog_team"."session_recording_retention_period_days",
-         "posthog_team"."external_data_workspace_id",
-         "posthog_team"."external_data_workspace_last_synced_at",
-         "posthog_team"."api_query_rate_limit"
-  FROM "posthog_team"
-  WHERE "posthog_team"."id" = 99999
+  SELECT "posthog_remoteconfig"."id",
+         "posthog_remoteconfig"."team_id",
+         "posthog_remoteconfig"."config",
+         "posthog_remoteconfig"."updated_at",
+         "posthog_remoteconfig"."synced_at"
+  FROM "posthog_remoteconfig"
+  WHERE "posthog_remoteconfig"."team_id" = 99999
   LIMIT 21
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.11
+# name: TestSurveysAPIList.test_list_surveys.10
   '''
   SELECT "posthog_remoteconfig"."id",
          "posthog_remoteconfig"."team_id",
@@ -189,7 +118,7 @@
   LIMIT 21
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.12
+# name: TestSurveysAPIList.test_list_surveys.11
   '''
   SELECT "posthog_team"."id",
          "posthog_team"."uuid",
@@ -267,7 +196,7 @@
   LIMIT 21
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.13
+# name: TestSurveysAPIList.test_list_surveys.12
   '''
   SELECT COUNT(*) AS "__count"
   FROM "posthog_featureflag"
@@ -276,7 +205,7 @@
          AND "posthog_featureflag"."team_id" = 99999)
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.14
+# name: TestSurveysAPIList.test_list_surveys.13
   '''
   SELECT "posthog_survey"."id",
          "posthog_survey"."team_id",
@@ -374,7 +303,7 @@
          AND NOT ("posthog_survey"."archived"))
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.15
+# name: TestSurveysAPIList.test_list_surveys.14
   '''
   SELECT ("posthog_survey_actions"."survey_id") AS "_prefetch_related_val_survey_id",
          "posthog_action"."id",
@@ -402,7 +331,7 @@
                                                  '00000000-0000-0000-0000-000000000001'::uuid, /* ... */])
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.16
+# name: TestSurveysAPIList.test_list_surveys.15
   '''
   SELECT "posthog_pluginconfig"."id",
          "posthog_pluginsourcefile"."transpiled",
@@ -418,7 +347,7 @@
          AND "posthog_pluginconfig"."team_id" = 99999)
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.17
+# name: TestSurveysAPIList.test_list_surveys.16
   '''
   SELECT "posthog_hogfunction"."id",
          "posthog_hogfunction"."team_id",
@@ -522,7 +451,7 @@
                                               'site_app'))
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.18
+# name: TestSurveysAPIList.test_list_surveys.17
   '''
   SELECT "posthog_featureflag"."id",
          "posthog_featureflag"."key",
@@ -550,7 +479,7 @@
          AND "posthog_team"."project_id" = 99999)
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.19
+# name: TestSurveysAPIList.test_list_surveys.18
   '''
   SELECT "posthog_team"."id",
          "posthog_team"."uuid",
@@ -621,7 +550,7 @@
   LIMIT 21
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.2
+# name: TestSurveysAPIList.test_list_surveys.19
   '''
   SELECT "posthog_remoteconfig"."id",
          "posthog_remoteconfig"."team_id",
@@ -633,19 +562,85 @@
   LIMIT 21
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.20
+# name: TestSurveysAPIList.test_list_surveys.2
   '''
-  SELECT "posthog_remoteconfig"."id",
-         "posthog_remoteconfig"."team_id",
-         "posthog_remoteconfig"."config",
-         "posthog_remoteconfig"."updated_at",
-         "posthog_remoteconfig"."synced_at"
-  FROM "posthog_remoteconfig"
-  WHERE "posthog_remoteconfig"."team_id" = 99999
+  SELECT "posthog_team"."id",
+         "posthog_team"."uuid",
+         "posthog_team"."organization_id",
+         "posthog_team"."project_id",
+         "posthog_team"."api_token",
+         "posthog_team"."app_urls",
+         "posthog_team"."name",
+         "posthog_team"."slack_incoming_webhook",
+         "posthog_team"."created_at",
+         "posthog_team"."updated_at",
+         "posthog_team"."anonymize_ips",
+         "posthog_team"."completed_snippet_onboarding",
+         "posthog_team"."has_completed_onboarding_for",
+         "posthog_team"."onboarding_tasks",
+         "posthog_team"."ingested_event",
+         "posthog_team"."autocapture_opt_out",
+         "posthog_team"."autocapture_web_vitals_opt_in",
+         "posthog_team"."autocapture_web_vitals_allowed_metrics",
+         "posthog_team"."autocapture_exceptions_opt_in",
+         "posthog_team"."autocapture_exceptions_errors_to_ignore",
+         "posthog_team"."person_processing_opt_out",
+         "posthog_team"."session_recording_opt_in",
+         "posthog_team"."session_recording_sample_rate",
+         "posthog_team"."session_recording_minimum_duration_milliseconds",
+         "posthog_team"."session_recording_linked_flag",
+         "posthog_team"."session_recording_network_payload_capture_config",
+         "posthog_team"."session_recording_masking_config",
+         "posthog_team"."session_recording_url_trigger_config",
+         "posthog_team"."session_recording_url_blocklist_config",
+         "posthog_team"."session_recording_event_trigger_config",
+         "posthog_team"."session_replay_config",
+         "posthog_team"."survey_config",
+         "posthog_team"."capture_console_log_opt_in",
+         "posthog_team"."capture_performance_opt_in",
+         "posthog_team"."capture_dead_clicks",
+         "posthog_team"."surveys_opt_in",
+         "posthog_team"."heatmaps_opt_in",
+         "posthog_team"."flags_persistence_default",
+         "posthog_team"."session_recording_version",
+         "posthog_team"."signup_token",
+         "posthog_team"."is_demo",
+         "posthog_team"."access_control",
+         "posthog_team"."week_start_day",
+         "posthog_team"."inject_web_apps",
+         "posthog_team"."test_account_filters",
+         "posthog_team"."test_account_filters_default_checked",
+         "posthog_team"."path_cleaning_filters",
+         "posthog_team"."timezone",
+         "posthog_team"."data_attributes",
+         "posthog_team"."person_display_name_properties",
+         "posthog_team"."live_events_columns",
+         "posthog_team"."recording_domains",
+         "posthog_team"."human_friendly_comparison_periods",
+         "posthog_team"."cookieless_server_hash_mode",
+         "posthog_team"."revenue_tracking_config",
+         "posthog_team"."primary_dashboard_id",
+         "posthog_team"."default_data_theme",
+         "posthog_team"."extra_settings",
+         "posthog_team"."modifiers",
+         "posthog_team"."correlation_config",
+         "posthog_team"."session_recording_retention_period_days",
+         "posthog_team"."plugins_opt_in",
+         "posthog_team"."opt_out_capture",
+         "posthog_team"."event_names",
+         "posthog_team"."event_names_with_usage",
+         "posthog_team"."event_properties",
+         "posthog_team"."event_properties_with_usage",
+         "posthog_team"."event_properties_numerical",
+         "posthog_team"."external_data_workspace_id",
+         "posthog_team"."external_data_workspace_last_synced_at",
+         "posthog_team"."api_query_rate_limit"
+  FROM "posthog_team"
+  WHERE "posthog_team"."id" = 99999
   LIMIT 21
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.21
+# name: TestSurveysAPIList.test_list_surveys.20
   '''
   SELECT "posthog_team"."id",
          "posthog_team"."uuid",
@@ -723,7 +718,7 @@
   LIMIT 21
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.22
+# name: TestSurveysAPIList.test_list_surveys.21
   '''
   SELECT COUNT(*) AS "__count"
   FROM "posthog_featureflag"
@@ -732,7 +727,7 @@
          AND "posthog_featureflag"."team_id" = 99999)
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.23
+# name: TestSurveysAPIList.test_list_surveys.22
   '''
   SELECT "posthog_survey"."id",
          "posthog_survey"."team_id",
@@ -830,7 +825,7 @@
          AND NOT ("posthog_survey"."archived"))
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.24
+# name: TestSurveysAPIList.test_list_surveys.23
   '''
   SELECT ("posthog_survey_actions"."survey_id") AS "_prefetch_related_val_survey_id",
          "posthog_action"."id",
@@ -858,7 +853,7 @@
                                                  '00000000-0000-0000-0000-000000000001'::uuid, /* ... */])
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.25
+# name: TestSurveysAPIList.test_list_surveys.24
   '''
   SELECT "posthog_pluginconfig"."id",
          "posthog_pluginsourcefile"."transpiled",
@@ -874,7 +869,7 @@
          AND "posthog_pluginconfig"."team_id" = 99999)
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.26
+# name: TestSurveysAPIList.test_list_surveys.25
   '''
   SELECT "posthog_hogfunction"."id",
          "posthog_hogfunction"."team_id",
@@ -978,7 +973,7 @@
                                               'site_app'))
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.27
+# name: TestSurveysAPIList.test_list_surveys.26
   '''
   SELECT "posthog_featureflag"."id",
          "posthog_featureflag"."key",
@@ -1006,7 +1001,7 @@
          AND "posthog_team"."project_id" = 99999)
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.28
+# name: TestSurveysAPIList.test_list_surveys.27
   '''
   SELECT "posthog_team"."id",
          "posthog_team"."uuid",
@@ -1077,7 +1072,7 @@
   LIMIT 21
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.29
+# name: TestSurveysAPIList.test_list_surveys.28
   '''
   SELECT "posthog_remoteconfig"."id",
          "posthog_remoteconfig"."team_id",
@@ -1089,7 +1084,7 @@
   LIMIT 21
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.3
+# name: TestSurveysAPIList.test_list_surveys.29
   '''
   SELECT "posthog_team"."id",
          "posthog_team"."uuid",
@@ -1167,85 +1162,16 @@
   LIMIT 21
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.30
-  '''
-  SELECT "posthog_team"."id",
-         "posthog_team"."uuid",
-         "posthog_team"."organization_id",
-         "posthog_team"."project_id",
-         "posthog_team"."api_token",
-         "posthog_team"."app_urls",
-         "posthog_team"."name",
-         "posthog_team"."slack_incoming_webhook",
-         "posthog_team"."created_at",
-         "posthog_team"."updated_at",
-         "posthog_team"."anonymize_ips",
-         "posthog_team"."completed_snippet_onboarding",
-         "posthog_team"."has_completed_onboarding_for",
-         "posthog_team"."onboarding_tasks",
-         "posthog_team"."ingested_event",
-         "posthog_team"."autocapture_opt_out",
-         "posthog_team"."autocapture_web_vitals_opt_in",
-         "posthog_team"."autocapture_web_vitals_allowed_metrics",
-         "posthog_team"."autocapture_exceptions_opt_in",
-         "posthog_team"."autocapture_exceptions_errors_to_ignore",
-         "posthog_team"."person_processing_opt_out",
-         "posthog_team"."session_recording_opt_in",
-         "posthog_team"."session_recording_sample_rate",
-         "posthog_team"."session_recording_minimum_duration_milliseconds",
-         "posthog_team"."session_recording_linked_flag",
-         "posthog_team"."session_recording_network_payload_capture_config",
-         "posthog_team"."session_recording_masking_config",
-         "posthog_team"."session_recording_url_trigger_config",
-         "posthog_team"."session_recording_url_blocklist_config",
-         "posthog_team"."session_recording_event_trigger_config",
-         "posthog_team"."session_replay_config",
-         "posthog_team"."survey_config",
-         "posthog_team"."capture_console_log_opt_in",
-         "posthog_team"."capture_performance_opt_in",
-         "posthog_team"."capture_dead_clicks",
-         "posthog_team"."surveys_opt_in",
-         "posthog_team"."heatmaps_opt_in",
-         "posthog_team"."flags_persistence_default",
-         "posthog_team"."session_recording_version",
-         "posthog_team"."signup_token",
-         "posthog_team"."is_demo",
-         "posthog_team"."access_control",
-         "posthog_team"."week_start_day",
-         "posthog_team"."inject_web_apps",
-         "posthog_team"."test_account_filters",
-         "posthog_team"."test_account_filters_default_checked",
-         "posthog_team"."path_cleaning_filters",
-         "posthog_team"."timezone",
-         "posthog_team"."data_attributes",
-         "posthog_team"."person_display_name_properties",
-         "posthog_team"."live_events_columns",
-         "posthog_team"."recording_domains",
-         "posthog_team"."human_friendly_comparison_periods",
-         "posthog_team"."cookieless_server_hash_mode",
-         "posthog_team"."revenue_tracking_config",
-         "posthog_team"."primary_dashboard_id",
-         "posthog_team"."default_data_theme",
-         "posthog_team"."extra_settings",
-         "posthog_team"."modifiers",
-         "posthog_team"."correlation_config",
-         "posthog_team"."session_recording_retention_period_days",
-         "posthog_team"."plugins_opt_in",
-         "posthog_team"."opt_out_capture",
-         "posthog_team"."event_names",
-         "posthog_team"."event_names_with_usage",
-         "posthog_team"."event_properties",
-         "posthog_team"."event_properties_with_usage",
-         "posthog_team"."event_properties_numerical",
-         "posthog_team"."external_data_workspace_id",
-         "posthog_team"."external_data_workspace_last_synced_at",
-         "posthog_team"."api_query_rate_limit"
-  FROM "posthog_team"
-  WHERE "posthog_team"."id" = 99999
-  LIMIT 21
+# name: TestSurveysAPIList.test_list_surveys.3
+  '''
+  SELECT COUNT(*) AS "__count"
+  FROM "posthog_featureflag"
+  WHERE ("posthog_featureflag"."active"
+         AND NOT "posthog_featureflag"."deleted"
+         AND "posthog_featureflag"."team_id" = 99999)
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.31
+# name: TestSurveysAPIList.test_list_surveys.30
   '''
   SELECT COUNT(*) AS "__count"
   FROM "posthog_featureflag"
@@ -1254,7 +1180,7 @@
          AND "posthog_featureflag"."team_id" = 99999)
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.32
+# name: TestSurveysAPIList.test_list_surveys.31
   '''
   SELECT "posthog_survey"."id",
          "posthog_survey"."team_id",
@@ -1352,7 +1278,7 @@
          AND NOT ("posthog_survey"."archived"))
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.33
+# name: TestSurveysAPIList.test_list_surveys.32
   '''
   SELECT ("posthog_survey_actions"."survey_id") AS "_prefetch_related_val_survey_id",
          "posthog_action"."id",
@@ -1380,7 +1306,7 @@
                                                  '00000000-0000-0000-0000-000000000001'::uuid, /* ... */])
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.34
+# name: TestSurveysAPIList.test_list_surveys.33
   '''
   SELECT "posthog_pluginconfig"."id",
          "posthog_pluginsourcefile"."transpiled",
@@ -1396,7 +1322,7 @@
          AND "posthog_pluginconfig"."team_id" = 99999)
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.35
+# name: TestSurveysAPIList.test_list_surveys.34
   '''
   SELECT "posthog_hogfunction"."id",
          "posthog_hogfunction"."team_id",
@@ -1500,19 +1426,7 @@
                                               'site_app'))
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.36
-  '''
-  SELECT COUNT(*) AS "__count"
-  FROM "posthog_survey"
-  INNER JOIN "posthog_team" ON ("posthog_survey"."team_id" = "posthog_team"."id")
-  WHERE (NOT "posthog_survey"."archived"
-         AND "posthog_survey"."end_date" IS NULL
-         AND "posthog_survey"."start_date" IS NOT NULL
-         AND "posthog_team"."project_id" = 99999
-         AND NOT ("posthog_survey"."type" = 'api'))
-  '''
-# ---
-# name: TestSurveysAPIList.test_list_surveys.37
+# name: TestSurveysAPIList.test_list_surveys.35
   '''
   SELECT "posthog_team"."id",
          "posthog_team"."uuid",
@@ -1583,7 +1497,7 @@
   LIMIT 21
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.38
+# name: TestSurveysAPIList.test_list_surveys.36
   '''
   SELECT "posthog_remoteconfig"."id",
          "posthog_remoteconfig"."team_id",
@@ -1595,7 +1509,7 @@
   LIMIT 21
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.39
+# name: TestSurveysAPIList.test_list_surveys.37
   '''
   SELECT "posthog_team"."id",
          "posthog_team"."uuid",
@@ -1673,7 +1587,7 @@
   LIMIT 21
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.4
+# name: TestSurveysAPIList.test_list_surveys.38
   '''
   SELECT COUNT(*) AS "__count"
   FROM "posthog_featureflag"
@@ -1682,16 +1596,105 @@
          AND "posthog_featureflag"."team_id" = 99999)
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.40
+# name: TestSurveysAPIList.test_list_surveys.39
   '''
-  SELECT COUNT(*) AS "__count"
-  FROM "posthog_featureflag"
-  WHERE ("posthog_featureflag"."active"
-         AND NOT "posthog_featureflag"."deleted"
-         AND "posthog_featureflag"."team_id" = 99999)
+  SELECT "posthog_survey"."id",
+         "posthog_survey"."team_id",
+         "posthog_survey"."name",
+         "posthog_survey"."description",
+         "posthog_survey"."linked_flag_id",
+         "posthog_survey"."targeting_flag_id",
+         "posthog_survey"."internal_targeting_flag_id",
+         "posthog_survey"."internal_response_sampling_flag_id",
+         "posthog_survey"."type",
+         "posthog_survey"."conditions",
+         "posthog_survey"."questions",
+         "posthog_survey"."appearance",
+         "posthog_survey"."created_at",
+         "posthog_survey"."created_by_id",
+         "posthog_survey"."start_date",
+         "posthog_survey"."end_date",
+         "posthog_survey"."updated_at",
+         "posthog_survey"."archived",
+         "posthog_survey"."responses_limit",
+         "posthog_survey"."response_sampling_start_date",
+         "posthog_survey"."response_sampling_interval_type",
+         "posthog_survey"."response_sampling_interval",
+         "posthog_survey"."response_sampling_limit",
+         "posthog_survey"."response_sampling_daily_limits",
+         "posthog_survey"."iteration_count",
+         "posthog_survey"."iteration_frequency_days",
+         "posthog_survey"."iteration_start_dates",
+         "posthog_survey"."current_iteration",
+         "posthog_survey"."current_iteration_start_date",
+         "posthog_survey"."schedule",
+         "posthog_survey"."enable_partial_responses",
+         "posthog_featureflag"."id",
+         "posthog_featureflag"."key",
+         "posthog_featureflag"."name",
+         "posthog_featureflag"."filters",
+         "posthog_featureflag"."rollout_percentage",
+         "posthog_featureflag"."team_id",
+         "posthog_featureflag"."created_by_id",
+         "posthog_featureflag"."created_at",
+         "posthog_featureflag"."deleted",
+         "posthog_featureflag"."active",
+         "posthog_featureflag"."version",
+         "posthog_featureflag"."last_modified_by_id",
+         "posthog_featureflag"."rollback_conditions",
+         "posthog_featureflag"."performed_rollback",
+         "posthog_featureflag"."ensure_experience_continuity",
+         "posthog_featureflag"."usage_dashboard_id",
+         "posthog_featureflag"."has_enriched_analytics",
+         "posthog_featureflag"."is_remote_configuration",
+         "posthog_featureflag"."has_encrypted_payloads",
+         T4."id",
+         T4."key",
+         T4."name",
+         T4."filters",
+         T4."rollout_percentage",
+         T4."team_id",
+         T4."created_by_id",
+         T4."created_at",
+         T4."deleted",
+         T4."active",
+         T4."version",
+         T4."last_modified_by_id",
+         T4."rollback_conditions",
+         T4."performed_rollback",
+         T4."ensure_experience_continuity",
+         T4."usage_dashboard_id",
+         T4."has_enriched_analytics",
+         T4."is_remote_configuration",
+         T4."has_encrypted_payloads",
+         T5."id",
+         T5."key",
+         T5."name",
+         T5."filters",
+         T5."rollout_percentage",
+         T5."team_id",
+         T5."created_by_id",
+         T5."created_at",
+         T5."deleted",
+         T5."active",
+         T5."version",
+         T5."last_modified_by_id",
+         T5."rollback_conditions",
+         T5."performed_rollback",
+         T5."ensure_experience_continuity",
+         T5."usage_dashboard_id",
+         T5."has_enriched_analytics",
+         T5."is_remote_configuration",
+         T5."has_encrypted_payloads"
+  FROM "posthog_survey"
+  LEFT OUTER JOIN "posthog_featureflag" ON ("posthog_survey"."linked_flag_id" = "posthog_featureflag"."id")
+  LEFT OUTER JOIN "posthog_featureflag" T4 ON ("posthog_survey"."targeting_flag_id" = T4."id")
+  LEFT OUTER JOIN "posthog_featureflag" T5 ON ("posthog_survey"."internal_targeting_flag_id" = T5."id")
+  WHERE ("posthog_survey"."team_id" = 99999
+         AND NOT ("posthog_survey"."archived"))
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.41
+# name: TestSurveysAPIList.test_list_surveys.4
   '''
   SELECT "posthog_survey"."id",
          "posthog_survey"."team_id",
@@ -1789,7 +1792,7 @@
          AND NOT ("posthog_survey"."archived"))
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.42
+# name: TestSurveysAPIList.test_list_surveys.40
   '''
   SELECT ("posthog_survey_actions"."survey_id") AS "_prefetch_related_val_survey_id",
          "posthog_action"."id",
@@ -1817,7 +1820,7 @@
                                                  '00000000-0000-0000-0000-000000000001'::uuid, /* ... */])
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.43
+# name: TestSurveysAPIList.test_list_surveys.41
   '''
   SELECT "posthog_pluginconfig"."id",
          "posthog_pluginsourcefile"."transpiled",
@@ -1833,7 +1836,7 @@
          AND "posthog_pluginconfig"."team_id" = 99999)
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.44
+# name: TestSurveysAPIList.test_list_surveys.42
   '''
   SELECT "posthog_hogfunction"."id",
          "posthog_hogfunction"."team_id",
@@ -1937,7 +1940,7 @@
                                               'site_app'))
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.45
+# name: TestSurveysAPIList.test_list_surveys.43
   '''
   SELECT "posthog_user"."id",
          "posthog_user"."password",
@@ -1970,7 +1973,7 @@
   LIMIT 21
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.46
+# name: TestSurveysAPIList.test_list_surveys.44
   '''
   SELECT "posthog_team"."id",
          "posthog_team"."uuid",
@@ -2041,7 +2044,7 @@
   LIMIT 21
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.47
+# name: TestSurveysAPIList.test_list_surveys.45
   '''
   SELECT "posthog_survey"."id",
          "posthog_survey"."team_id",
@@ -2139,7 +2142,7 @@
          AND NOT ("posthog_survey"."archived"))
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.48
+# name: TestSurveysAPIList.test_list_surveys.46
   '''
   SELECT ("posthog_survey_actions"."survey_id") AS "_prefetch_related_val_survey_id",
          "posthog_action"."id",
@@ -2167,7 +2170,7 @@
                                                  '00000000-0000-0000-0000-000000000001'::uuid, /* ... */])
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.5
+# name: TestSurveysAPIList.test_list_surveys.47
   '''
   SELECT "posthog_survey"."id",
          "posthog_survey"."team_id",
@@ -2265,7 +2268,7 @@
          AND NOT ("posthog_survey"."archived"))
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.6
+# name: TestSurveysAPIList.test_list_surveys.48
   '''
   SELECT ("posthog_survey_actions"."survey_id") AS "_prefetch_related_val_survey_id",
          "posthog_action"."id",
@@ -2293,7 +2296,35 @@
                                                  '00000000-0000-0000-0000-000000000001'::uuid, /* ... */])
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.7
+# name: TestSurveysAPIList.test_list_surveys.5
+  '''
+  SELECT ("posthog_survey_actions"."survey_id") AS "_prefetch_related_val_survey_id",
+         "posthog_action"."id",
+         "posthog_action"."name",
+         "posthog_action"."team_id",
+         "posthog_action"."description",
+         "posthog_action"."created_at",
+         "posthog_action"."created_by_id",
+         "posthog_action"."deleted",
+         "posthog_action"."post_to_slack",
+         "posthog_action"."slack_message_format",
+         "posthog_action"."updated_at",
+         "posthog_action"."bytecode",
+         "posthog_action"."bytecode_error",
+         "posthog_action"."steps_json",
+         "posthog_action"."pinned_at",
+         "posthog_action"."summary",
+         "posthog_action"."last_summarized_at",
+         "posthog_action"."embedding_last_synced_at",
+         "posthog_action"."is_calculating",
+         "posthog_action"."last_calculated_at"
+  FROM "posthog_action"
+  INNER JOIN "posthog_survey_actions" ON ("posthog_action"."id" = "posthog_survey_actions"."action_id")
+  WHERE 'posthog_survey_actions'.'survey_id' IN ('00000000-0000-0000-0000-000000000000'::uuid,
+                                                 '00000000-0000-0000-0000-000000000001'::uuid, /* ... */])
+  '''
+# ---
+# name: TestSurveysAPIList.test_list_surveys.6
   '''
   SELECT "posthog_pluginconfig"."id",
          "posthog_pluginsourcefile"."transpiled",
@@ -2309,7 +2340,7 @@
          AND "posthog_pluginconfig"."team_id" = 99999)
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.8
+# name: TestSurveysAPIList.test_list_surveys.7
   '''
   SELECT "posthog_hogfunction"."id",
          "posthog_hogfunction"."team_id",
@@ -2413,7 +2444,7 @@
                                               'site_app'))
   '''
 # ---
-# name: TestSurveysAPIList.test_list_surveys.9
+# name: TestSurveysAPIList.test_list_surveys.8
   '''
   SELECT "posthog_featureflag"."id",
          "posthog_featureflag"."key",
@@ -2441,3 +2472,74 @@
          AND "posthog_team"."project_id" = 99999)
   '''
 # ---
+# name: TestSurveysAPIList.test_list_surveys.9
+  '''
+  SELECT "posthog_team"."id",
+         "posthog_team"."uuid",
+         "posthog_team"."organization_id",
+         "posthog_team"."project_id",
+         "posthog_team"."api_token",
+         "posthog_team"."app_urls",
+         "posthog_team"."name",
+         "posthog_team"."slack_incoming_webhook",
+         "posthog_team"."created_at",
+         "posthog_team"."updated_at",
+         "posthog_team"."anonymize_ips",
+         "posthog_team"."completed_snippet_onboarding",
+         "posthog_team"."has_completed_onboarding_for",
+         "posthog_team"."onboarding_tasks",
+         "posthog_team"."ingested_event",
+         "posthog_team"."autocapture_opt_out",
+         "posthog_team"."autocapture_web_vitals_opt_in",
+         "posthog_team"."autocapture_web_vitals_allowed_metrics",
+         "posthog_team"."autocapture_exceptions_opt_in",
+         "posthog_team"."autocapture_exceptions_errors_to_ignore",
+         "posthog_team"."person_processing_opt_out",
+         "posthog_team"."session_recording_opt_in",
+         "posthog_team"."session_recording_sample_rate",
+         "posthog_team"."session_recording_minimum_duration_milliseconds",
+         "posthog_team"."session_recording_linked_flag",
+         "posthog_team"."session_recording_network_payload_capture_config",
+         "posthog_team"."session_recording_masking_config",
+         "posthog_team"."session_recording_url_trigger_config",
+         "posthog_team"."session_recording_url_blocklist_config",
+         "posthog_team"."session_recording_event_trigger_config",
+         "posthog_team"."session_replay_config",
+         "posthog_team"."survey_config",
+         "posthog_team"."capture_console_log_opt_in",
+         "posthog_team"."capture_performance_opt_in",
+         "posthog_team"."capture_dead_clicks",
+         "posthog_team"."surveys_opt_in",
+         "posthog_team"."heatmaps_opt_in",
+         "posthog_team"."flags_persistence_default",
+         "posthog_team"."session_recording_version",
+         "posthog_team"."signup_token",
+         "posthog_team"."is_demo",
+         "posthog_team"."access_control",
+         "posthog_team"."week_start_day",
+         "posthog_team"."inject_web_apps",
+         "posthog_team"."test_account_filters",
+         "posthog_team"."test_account_filters_default_checked",
+         "posthog_team"."path_cleaning_filters",
+         "posthog_team"."timezone",
+         "posthog_team"."data_attributes",
+         "posthog_team"."person_display_name_properties",
+         "posthog_team"."live_events_columns",
+         "posthog_team"."recording_domains",
+         "posthog_team"."human_friendly_comparison_periods",
+         "posthog_team"."cookieless_server_hash_mode",
+         "posthog_team"."revenue_tracking_config",
+         "posthog_team"."primary_dashboard_id",
+         "posthog_team"."default_data_theme",
+         "posthog_team"."extra_settings",
+         "posthog_team"."modifiers",
+         "posthog_team"."correlation_config",
+         "posthog_team"."session_recording_retention_period_days",
+         "posthog_team"."external_data_workspace_id",
+         "posthog_team"."external_data_workspace_last_synced_at",
+         "posthog_team"."api_query_rate_limit"
+  FROM "posthog_team"
+  WHERE "posthog_team"."id" = 99999
+  LIMIT 21
+  '''
+# ---
diff --git a/posthog/api/test/test_survey.py b/posthog/api/test/test_survey.py
index 4896b6d91aab..55637bdedc34 100644
--- a/posthog/api/test/test_survey.py
+++ b/posthog/api/test/test_survey.py
@@ -1210,103 +1210,6 @@ def test_updating_survey_name_validates(self):
             updated_survey_deletes_targeting_flag.json()["detail"] == "There is already another survey with this name."
         )
 
-    def test_enable_surveys_opt_in(self):
-        Survey.objects.create(
-            team=self.team,
-            created_by=self.user,
-            name="Survey 1",
-            type="popover",
-            questions=[{"type": "open", "question": "What's a survey?"}],
-            start_date=datetime.now() - timedelta(days=2),
-            end_date=datetime.now() - timedelta(days=1),
-        )
-        self.assertEqual(self.team.surveys_opt_in, None)
-        Survey.objects.create(
-            team=self.team,
-            created_by=self.user,
-            name="Survey 2",
-            type="popover",
-            questions=[{"type": "open", "question": "What's a hedgehog?"}],
-            start_date=datetime.now() - timedelta(days=2),
-        )
-        assert self.team.surveys_opt_in is True
-
-    def test_disable_surveys_opt_in(self):
-        survey = Survey.objects.create(
-            team=self.team,
-            created_by=self.user,
-            name="Survey 2",
-            type="popover",
-            questions=[{"type": "open", "question": "What's a hedgehog?"}],
-            start_date=datetime.now() - timedelta(days=2),
-        )
-        assert self.team.surveys_opt_in is True
-        self.client.patch(
-            f"/api/projects/{self.team.id}/surveys/{survey.id}/",
-            data={"end_date": datetime.now() - timedelta(days=1)},
-        )
-        self.team.refresh_from_db()
-        assert self.team.surveys_opt_in is False
-
-    def test_surveys_opt_in_with_api_type_surveys(self):
-        api_survey = Survey.objects.create(
-            team=self.team,
-            created_by=self.user,
-            name="API survey",
-            type="api",
-            questions=[{"type": "open", "question": "What's a survey?"}],
-            start_date=datetime.now() - timedelta(days=2),
-        )
-        self.assertEqual(self.team.surveys_opt_in, None)
-        popover_survey = Survey.objects.create(
-            team=self.team,
-            created_by=self.user,
-            name="Popover survey",
-            type="popover",
-            questions=[{"type": "open", "question": "What's a survey?"}],
-            start_date=datetime.now() - timedelta(days=2),
-        )
-        self.team.refresh_from_db()
-        assert self.team.surveys_opt_in is True
-        self.client.patch(
-            f"/api/projects/{self.team.id}/surveys/{api_survey.id}/",
-            data={"end_date": datetime.now() - timedelta(days=1)},
-        )
-        self.team.refresh_from_db()
-        self.assertEqual(self.team.surveys_opt_in, True)
-        self.client.patch(
-            f"/api/projects/{self.team.id}/surveys/{popover_survey.id}/",
-            data={"end_date": datetime.now() - timedelta(days=1)},
-        )
-        self.team.refresh_from_db()
-        assert self.team.surveys_opt_in is False
-
-    def test_surveys_opt_in_post_delete(self):
-        Survey.objects.create(
-            team=self.team,
-            created_by=self.user,
-            name="Survey 1",
-            type="popover",
-            questions=[{"type": "open", "question": "What's a survey?"}],
-            start_date=datetime.now() - timedelta(days=2),
-            end_date=datetime.now() - timedelta(days=1),
-        )
-        survey_to_delete = Survey.objects.create(
-            team=self.team,
-            created_by=self.user,
-            name="Survey 2",
-            type="popover",
-            questions=[{"type": "open", "question": "What's a survey?"}],
-            start_date=datetime.now() - timedelta(days=2),
-        )
-        assert self.team.surveys_opt_in is True
-        self.client.delete(
-            f"/api/projects/{self.team.id}/surveys/{survey_to_delete.id}/",
-            format="json",
-        )
-        self.team.refresh_from_db()
-        assert self.team.surveys_opt_in is False
-
     @freeze_time("2023-05-01 12:00:00")
     def test_update_survey_targeting_flag_filters_records_activity(self):
         linked_flag = FeatureFlag.objects.create(team=self.team, key="linked-flag", created_by=self.user)
diff --git a/posthog/models/surveys/survey.py b/posthog/models/surveys/survey.py
index d5658d106195..f21f8a1a51bd 100644
--- a/posthog/models/surveys/survey.py
+++ b/posthog/models/surveys/survey.py
@@ -3,10 +3,8 @@
 from datetime import timedelta
 
 from django.db import models
-from django.db.models.signals import post_save, post_delete
 
 from posthog.models import Action
-from posthog.models.signals import mutable_receiver
 from posthog.models.utils import UUIDModel
 from django.contrib.postgres.fields import ArrayField
 from dateutil.rrule import rrule, DAILY
@@ -320,24 +318,3 @@ def update_survey_iterations(sender, instance, *args, **kwargs):
     if iteration_count > 0 and (instance.current_iteration is None or instance.current_iteration == 0):
         instance.current_iteration = 1
         instance.current_iteration_start_date = instance.start_date
-
-
-@mutable_receiver([post_save, post_delete], sender=Survey)
-def update_surveys_opt_in(sender, instance, **kwargs):
-    active_surveys_count = (
-        Survey.objects.filter(
-            team__project_id=instance.team.project_id,
-            start_date__isnull=False,
-            end_date__isnull=True,
-            archived=False,
-        )
-        .exclude(type="api")
-        .count()
-    )
-
-    if active_surveys_count > 0 and not instance.team.surveys_opt_in:
-        instance.team.surveys_opt_in = True
-        instance.team.save(update_fields=["surveys_opt_in"])
-    elif active_surveys_count == 0 and instance.team.surveys_opt_in is True:
-        instance.team.surveys_opt_in = False
-        instance.team.save(update_fields=["surveys_opt_in"])


Reviews:
user: login: greptile-apps[bot]
body: 
## PR Summary

This PR modifies survey enablement behavior to prevent automatic activation when surveys are disabled at the project level, ensuring explicit user control over survey visibility.

- Removed `update_surveys_opt_in` signal handler in `/posthog/models/surveys/survey.py` to prevent automatic survey enablement
- Updated warning banner text in `/frontend/src/scenes/surveys/Surveys.tsx` to clarify that surveys won't be visible unless explicitly enabled
- Simplified `showSurveysDisabledBanner` logic in `/frontend/src/scenes/surveys/surveysLogic.tsx` to only check `surveys_opt_in` flag

<sub>3 file(s) reviewed, 1 comment(s)</sub>
<sub>[Edit PR Review Bot Settings](https://app.greptile.com/review/github) | [Greptile](https://greptile.com?utm_source=greptile_expert&utm_medium=github&utm_campaign=code_reviews&utm_content=posthog_30032)</sub>
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-17T17:47:30Z
user: login: marandaneto
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-18T08:25:06Z
user: login: benjackwhite
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-03-18T09:12:47Z
user: login: lucasheriques
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-18T13:05:39Z
user: login: marandaneto
state: APPROVED
author_association: MEMBER
submitted_at: 2025-03-18T13:11:55Z

Review comments:
diff_hunk: @@ -338,14 +338,9 @@ export const surveysLogic = kea<surveysLogicType>([
                 hasAvailableFeature(AvailableFeature.SURVEYS_ACTIONS),
         ],
         showSurveysDisabledBanner: [
-            (s) => [s.currentTeam, s.currentTeamLoading, s.data],
-            (currentTeam, currentTeamLoading, data) => {
-                return (
-                    !currentTeamLoading &&
-                    currentTeam &&
-                    !currentTeam.surveys_opt_in &&
-                    data.surveys.some((s: Survey) => s.start_date && !s.end_date && s.type !== SurveyType.API)
-                )
+            (s) => [s.currentTeam],
+            (currentTeam) => {
+                return currentTeam?.surveys_opt_in === false
             },
path: frontend/src/scenes/surveys/surveysLogic.tsx
user: login: greptile-apps[bot]
body: style: This change means the banner will show whenever surveys are disabled, regardless of whether there are active surveys. Consider if this is the intended behavior.
created_at: 2025-03-17T17:47:04Z
author_association: CONTRIBUTOR
diff_hunk: @@ -338,14 +338,9 @@ export const surveysLogic = kea<surveysLogicType>([
                 hasAvailableFeature(AvailableFeature.SURVEYS_ACTIONS),
         ],
         showSurveysDisabledBanner: [
-            (s) => [s.currentTeam, s.currentTeamLoading, s.data],
-            (currentTeam, currentTeamLoading, data) => {
-                return (
-                    !currentTeamLoading &&
-                    currentTeam &&
-                    !currentTeam.surveys_opt_in &&
-                    data.surveys.some((s: Survey) => s.start_date && !s.end_date && s.type !== SurveyType.API)
-                )
+            (s) => [s.currentTeam],
+            (currentTeam) => {
+                return currentTeam?.surveys_opt_in === false
path: frontend/src/scenes/surveys/surveysLogic.tsx
user: login: marandaneto
body: why did we remove the `currentTeamLoading` condition here?
created_at: 2025-03-18T08:25:05Z
author_association: MEMBER
diff_hunk: @@ -338,14 +338,9 @@ export const surveysLogic = kea<surveysLogicType>([
                 hasAvailableFeature(AvailableFeature.SURVEYS_ACTIONS),
         ],
         showSurveysDisabledBanner: [
-            (s) => [s.currentTeam, s.currentTeamLoading, s.data],
-            (currentTeam, currentTeamLoading, data) => {
-                return (
-                    !currentTeamLoading &&
-                    currentTeam &&
-                    !currentTeam.surveys_opt_in &&
-                    data.surveys.some((s: Survey) => s.start_date && !s.end_date && s.type !== SurveyType.API)
-                )
+            (s) => [s.currentTeam],
+            (currentTeam) => {
+                return currentTeam?.surveys_opt_in === false
path: frontend/src/scenes/surveys/surveysLogic.tsx
user: login: benjackwhite
body: currentTeam is generally always available as it is set on page load by django so maybe that?
created_at: 2025-03-18T09:12:41Z
author_association: CONTRIBUTOR
diff_hunk: @@ -338,14 +338,9 @@ export const surveysLogic = kea<surveysLogicType>([
                 hasAvailableFeature(AvailableFeature.SURVEYS_ACTIONS),
         ],
         showSurveysDisabledBanner: [
-            (s) => [s.currentTeam, s.currentTeamLoading, s.data],
-            (currentTeam, currentTeamLoading, data) => {
-                return (
-                    !currentTeamLoading &&
-                    currentTeam &&
-                    !currentTeam.surveys_opt_in &&
-                    data.surveys.some((s: Survey) => s.start_date && !s.end_date && s.type !== SurveyType.API)
-                )
+            (s) => [s.currentTeam],
+            (currentTeam) => {
+                return currentTeam?.surveys_opt_in === false
path: frontend/src/scenes/surveys/surveysLogic.tsx
user: login: lucasheriques
body: also, no need to check the loading, as we don't show a loading state for this banner. if it's loading, it just means `currentTeam` will be null, so nothing to check either way.
created_at: 2025-03-18T13:05:39Z
author_association: CONTRIBUTOR

PR comments:
user: login: github-actions[bot]
created_at: 2025-03-17T17:58:53Z
body: **Size Change:** -238 B (0%) 

**Total Size:** 9.74 MB



<details><summary>ℹ️ <strong>View Unchanged</strong></summary>

| Filename | Size | Change |
| :--- | :---: | :---: |
| `frontend/dist/toolbar.js` | 9.74 MB | -238 B (0%) |

</details>



<a href="https://github.com/preactjs/compressed-size-action"><sub>compressed-size-action</sub></a>
author_association: CONTRIBUTOR
user: login: posthog-bot
created_at: 2025-03-17T18:05:47Z
body: ## 📸 UI snapshots have been updated

**2** snapshot changes in total. **0** added, **2** modified, **0** deleted:

- **`chromium`**: **0** added, **2** modified, **0** deleted ([diff for shard 3](https://github.com/PostHog/posthog/pull/30032/commits/3b778f8f03fbb5feb9878ee2a76475890787c40f))
- `webkit`: **0** added, **0** modified, **0** deleted

Triggered by [this commit](https://github.com/PostHog/posthog/pull/30032/commits/84cc3734c6b2959cb9bb59126e7ef993f762f9c7).

👉 **[Review this PR's diff of snapshots.](https://github.com/PostHog/posthog/pull/30032/files#:~:text=frontend/__snapshots__/)**
author_association: CONTRIBUTOR
user: login: posthog-bot
created_at: 2025-03-18T13:29:43Z
body: ## 📸 UI snapshots have been updated

**2** snapshot changes in total. **0** added, **2** modified, **0** deleted:

- **`chromium`**: **0** added, **2** modified, **0** deleted ([diff for shard 3](https://github.com/PostHog/posthog/pull/30032/commits/c2e92e02a4aa19f2a5f96934762a7c2c46dcf489))
- `webkit`: **0** added, **0** modified, **0** deleted

Triggered by [this commit](https://github.com/PostHog/posthog/pull/30032/commits/3ef8f50e1b397a09c98c1521fc223fa0a95dc44e).

👉 **[Review this PR's diff of snapshots.](https://github.com/PostHog/posthog/pull/30032/files#:~:text=frontend/__snapshots__/)**
author_association: CONTRIBUTOR