From b01cf54a11ae4e4f7a1428d9a9378fc41b0cdbea Mon Sep 17 00:00:00 2001 From: Tim Broddin Date: Thu, 2 May 2024 15:31:52 +0200 Subject: [PATCH 1/3] Allow up to 24 updates --- client/blocks/plugins-scheduled-updates/config.ts | 2 +- client/blocks/plugins-scheduled-updates/schedule-list-empty.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/blocks/plugins-scheduled-updates/config.ts b/client/blocks/plugins-scheduled-updates/config.ts index 6ae29d15b90f5..557e25bc1ec4a 100644 --- a/client/blocks/plugins-scheduled-updates/config.ts +++ b/client/blocks/plugins-scheduled-updates/config.ts @@ -1,3 +1,3 @@ -export const MAX_SCHEDULES = 2; +export const MAX_SCHEDULES = 24; export const MAX_SELECTABLE_PLUGINS = 10; export const MAX_SELECTABLE_PATHS = 5; diff --git a/client/blocks/plugins-scheduled-updates/schedule-list-empty.tsx b/client/blocks/plugins-scheduled-updates/schedule-list-empty.tsx index 57f76bd347600..e0834f4b3b742 100644 --- a/client/blocks/plugins-scheduled-updates/schedule-list-empty.tsx +++ b/client/blocks/plugins-scheduled-updates/schedule-list-empty.tsx @@ -26,7 +26,7 @@ export const ScheduleListEmpty = ( props: Props ) => { return translate( 'This site is unable to schedule auto-updates for plugins.' ); } return translate( - "Take control of your site's maintenance by choosing when your plugins update—whatever day and time is most convenient. Up to two schedules let you enjoy hassle-free automatic updates, and our built-in rollback feature reverts any flawed updates for added peace of mind." + "Take control of your site's maintenance by choosing when your plugins update—whatever day and time is most convenient. Up to twenty-four schedules let you enjoy hassle-free automatic updates, and our built-in rollback feature reverts any flawed updates for added peace of mind." ); } )() } From 5a16d7af15aaa88c1f9c579553c0208b452ec04d Mon Sep 17 00:00:00 2001 From: Tim Broddin Date: Fri, 3 May 2024 09:40:05 +0200 Subject: [PATCH 2/3] Allow unlimited schedules --- client/blocks/plugins-scheduled-updates/config.ts | 2 +- client/blocks/plugins-scheduled-updates/index.tsx | 4 +++- client/blocks/plugins-scheduled-updates/schedule-create.tsx | 2 +- .../blocks/plugins-scheduled-updates/schedule-list-empty.tsx | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/client/blocks/plugins-scheduled-updates/config.ts b/client/blocks/plugins-scheduled-updates/config.ts index 557e25bc1ec4a..dd7e5e739821f 100644 --- a/client/blocks/plugins-scheduled-updates/config.ts +++ b/client/blocks/plugins-scheduled-updates/config.ts @@ -1,3 +1,3 @@ -export const MAX_SCHEDULES = 24; +export const MAX_SCHEDULES = -1; export const MAX_SELECTABLE_PLUGINS = 10; export const MAX_SELECTABLE_PATHS = 5; diff --git a/client/blocks/plugins-scheduled-updates/index.tsx b/client/blocks/plugins-scheduled-updates/index.tsx index ee5b34bae5185..9a93706ddce59 100644 --- a/client/blocks/plugins-scheduled-updates/index.tsx +++ b/client/blocks/plugins-scheduled-updates/index.tsx @@ -52,7 +52,9 @@ export const PluginsScheduledUpdates = ( props: Props ) => { const { data: schedules = [] } = useUpdateScheduleQuery( siteSlug, isEligibleForFeature ); const hideCreateButton = - ! isEligibleForFeature || schedules.length === MAX_SCHEDULES || schedules.length === 0; + ! isEligibleForFeature || + ( MAX_SCHEDULES && schedules.length === MAX_SCHEDULES ) || + schedules.length === 0; const { siteHasEligiblePlugins } = useSiteHasEligiblePlugins( siteSlug ); const { canCreateSchedules } = useCanCreateSchedules( siteSlug, isEligibleForFeature ); diff --git a/client/blocks/plugins-scheduled-updates/schedule-create.tsx b/client/blocks/plugins-scheduled-updates/schedule-create.tsx index a49342303b9f2..f9b37143c6c3b 100644 --- a/client/blocks/plugins-scheduled-updates/schedule-create.tsx +++ b/client/blocks/plugins-scheduled-updates/schedule-create.tsx @@ -50,7 +50,7 @@ export const ScheduleCreate = ( props: Props ) => { const [ syncError, setSyncError ] = useState( '' ); useEffect( () => { - if ( isFetched && schedules.length >= MAX_SCHEDULES ) { + if ( isFetched && MAX_SCHEDULES && schedules.length >= MAX_SCHEDULES ) { onNavBack && onNavBack(); } }, [ isFetched ] ); diff --git a/client/blocks/plugins-scheduled-updates/schedule-list-empty.tsx b/client/blocks/plugins-scheduled-updates/schedule-list-empty.tsx index e0834f4b3b742..479450967edc9 100644 --- a/client/blocks/plugins-scheduled-updates/schedule-list-empty.tsx +++ b/client/blocks/plugins-scheduled-updates/schedule-list-empty.tsx @@ -26,7 +26,7 @@ export const ScheduleListEmpty = ( props: Props ) => { return translate( 'This site is unable to schedule auto-updates for plugins.' ); } return translate( - "Take control of your site's maintenance by choosing when your plugins update—whatever day and time is most convenient. Up to twenty-four schedules let you enjoy hassle-free automatic updates, and our built-in rollback feature reverts any flawed updates for added peace of mind." + "Take control of your site's maintenance by choosing when your plugins update—whatever day and time is most convenient. Enjoy hassle-free automatic updates with our built-in rollback feature, reverting any flawed updates for added peace of mind." ); } )() } From e04ab2466fe03ad778c958d2578667a9d9e173e8 Mon Sep 17 00:00:00 2001 From: Tim Broddin Date: Fri, 3 May 2024 16:33:43 +0200 Subject: [PATCH 3/3] Remove MAX_SCHEDULES entirely --- client/blocks/plugins-scheduled-updates/config.ts | 1 - client/blocks/plugins-scheduled-updates/index.tsx | 6 +----- .../plugins-scheduled-updates/schedule-create.tsx | 12 ------------ 3 files changed, 1 insertion(+), 18 deletions(-) diff --git a/client/blocks/plugins-scheduled-updates/config.ts b/client/blocks/plugins-scheduled-updates/config.ts index dd7e5e739821f..d778a18f16c2c 100644 --- a/client/blocks/plugins-scheduled-updates/config.ts +++ b/client/blocks/plugins-scheduled-updates/config.ts @@ -1,3 +1,2 @@ -export const MAX_SCHEDULES = -1; export const MAX_SELECTABLE_PLUGINS = 10; export const MAX_SELECTABLE_PATHS = 5; diff --git a/client/blocks/plugins-scheduled-updates/index.tsx b/client/blocks/plugins-scheduled-updates/index.tsx index 9a93706ddce59..86febfb70dc75 100644 --- a/client/blocks/plugins-scheduled-updates/index.tsx +++ b/client/blocks/plugins-scheduled-updates/index.tsx @@ -11,7 +11,6 @@ import { useUpdateScheduleQuery } from 'calypso/data/plugins/use-update-schedule import { recordTracksEvent } from 'calypso/lib/analytics/tracks'; import { useSelector } from 'calypso/state'; import { getSelectedSiteId } from 'calypso/state/ui/selectors'; -import { MAX_SCHEDULES } from './config'; import { PluginUpdateManagerContextProvider } from './context'; import { useCanCreateSchedules } from './hooks/use-can-create-schedules'; import { useIsEligibleForFeature } from './hooks/use-is-eligible-for-feature'; @@ -51,10 +50,7 @@ export const PluginsScheduledUpdates = ( props: Props ) => { const { isEligibleForFeature, isSitePlansLoaded } = useIsEligibleForFeature(); const { data: schedules = [] } = useUpdateScheduleQuery( siteSlug, isEligibleForFeature ); - const hideCreateButton = - ! isEligibleForFeature || - ( MAX_SCHEDULES && schedules.length === MAX_SCHEDULES ) || - schedules.length === 0; + const hideCreateButton = ! isEligibleForFeature || schedules.length === 0; const { siteHasEligiblePlugins } = useSiteHasEligiblePlugins( siteSlug ); const { canCreateSchedules } = useCanCreateSchedules( siteSlug, isEligibleForFeature ); diff --git a/client/blocks/plugins-scheduled-updates/schedule-create.tsx b/client/blocks/plugins-scheduled-updates/schedule-create.tsx index f9b37143c6c3b..5a5b321ac4726 100644 --- a/client/blocks/plugins-scheduled-updates/schedule-create.tsx +++ b/client/blocks/plugins-scheduled-updates/schedule-create.tsx @@ -14,8 +14,6 @@ import { arrowLeft, info } from '@wordpress/icons'; import { useTranslate } from 'i18n-calypso'; import { useEffect, useState } from 'react'; import { Banner } from 'calypso/components/banner'; -import { useUpdateScheduleQuery } from 'calypso/data/plugins/use-update-schedules-query'; -import { MAX_SCHEDULES } from './config'; import { useCanCreateSchedules } from './hooks/use-can-create-schedules'; import { useCreateMonitor } from './hooks/use-create-monitor'; import { useIsEligibleForFeature } from './hooks/use-is-eligible-for-feature'; @@ -35,10 +33,6 @@ export const ScheduleCreate = ( props: Props ) => { const { siteHasEligiblePlugins, loading: siteHasEligiblePluginsLoading } = useSiteHasEligiblePlugins(); const { onNavBack } = props; - const { data: schedules = [], isFetched } = useUpdateScheduleQuery( - siteSlug, - isEligibleForFeature - ); const { canCreateSchedules, errors: eligibilityCheckErrors } = useCanCreateSchedules( siteSlug, isEligibleForFeature @@ -49,12 +43,6 @@ export const ScheduleCreate = ( props: Props ) => { const isBusy = pendingMutations.length > 0; const [ syncError, setSyncError ] = useState( '' ); - useEffect( () => { - if ( isFetched && MAX_SCHEDULES && schedules.length >= MAX_SCHEDULES ) { - onNavBack && onNavBack(); - } - }, [ isFetched ] ); - // Redirect back to list when no eligible plugins are installed useEffect( () => { if ( ! siteHasEligiblePlugins && ! siteHasEligiblePluginsLoading ) {