Skip to content

Commit

Permalink
update survey banner warning
Browse files Browse the repository at this point in the history
  • Loading branch information
liyiy committed Oct 19, 2023
1 parent 5ff7549 commit 9532df5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions frontend/src/scenes/surveys/Surveys.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ export function Surveys(): JSX.Element {

const { user } = useValues(userLogic)
const { currentTeam } = useValues(teamLogic)
const surveysPopupDisabled = currentTeam && !currentTeam?.surveys_opt_in
const surveysPopupDisabled =
currentTeam && !currentTeam?.surveys_opt_in && surveys.some((s) => s.start_date && !s.end_date)

const [tab, setSurveyTab] = useState(SurveysTabs.Active)
const shouldShowEmptyState = !surveysLoading && surveys.length === 0
Expand Down Expand Up @@ -139,7 +140,8 @@ export function Surveys(): JSX.Element {
}}
className="mb-2"
>
Survey popovers are currently disabled for this project.
Survey popovers are currently disabled for this project but there are active surveys running.
Re-enable them in the settings.
</LemonBanner>
) : null}
</div>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/scenes/surveys/surveyLogic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,8 @@ export const surveyLogic = kea<surveyLogicType>([
stopSurveySuccess: ({ survey }) => {
actions.loadSurveys()
if (values.currentTeam?.surveys_opt_in === true) {
const allActiveSurveys = values.surveys.filter((s) => s.start_date && !s.end_date)
if (allActiveSurveys.length === 0) {
const hasActiveSurveys = values.surveys.some((s) => s.start_date && !s.end_date)
if (!hasActiveSurveys) {
actions.setSurveysOptIn(false)
}
}
Expand Down

0 comments on commit 9532df5

Please sign in to comment.