Skip to content

Commit

Permalink
Scheduled Updates: Allow unlimited update schedules (#90212)
Browse files Browse the repository at this point in the history
* Allow up to 24 updates

* Allow unlimited schedules

* Remove MAX_SCHEDULES entirely
  • Loading branch information
TimBroddin authored May 6, 2024
1 parent 1bf0af5 commit 5e91c7e
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 17 deletions.
1 change: 0 additions & 1 deletion client/blocks/plugins-scheduled-updates/config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export const MAX_SCHEDULES = 2;
export const MAX_SELECTABLE_PLUGINS = 10;
export const MAX_SELECTABLE_PATHS = 5;
4 changes: 1 addition & 3 deletions client/blocks/plugins-scheduled-updates/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -51,8 +50,7 @@ export const PluginsScheduledUpdates = ( props: Props ) => {
const { isEligibleForFeature, isSitePlansLoaded } = useIsEligibleForFeature();
const { data: schedules = [] } = useUpdateScheduleQuery( siteSlug, isEligibleForFeature );

const hideCreateButton =
! isEligibleForFeature || schedules.length === MAX_SCHEDULES || schedules.length === 0;
const hideCreateButton = ! isEligibleForFeature || schedules.length === 0;

const { siteHasEligiblePlugins } = useSiteHasEligiblePlugins( siteSlug );
const { canCreateSchedules } = useCanCreateSchedules( siteSlug, isEligibleForFeature );
Expand Down
12 changes: 0 additions & 12 deletions client/blocks/plugins-scheduled-updates/schedule-create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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
Expand All @@ -49,12 +43,6 @@ export const ScheduleCreate = ( props: Props ) => {
const isBusy = pendingMutations.length > 0;
const [ syncError, setSyncError ] = useState( '' );

useEffect( () => {
if ( isFetched && schedules.length >= MAX_SCHEDULES ) {
onNavBack && onNavBack();
}
}, [ isFetched ] );

// Redirect back to list when no eligible plugins are installed
useEffect( () => {
if ( ! siteHasEligiblePlugins && ! siteHasEligiblePluginsLoading ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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. Enjoy hassle-free automatic updates with our built-in rollback feature, reverting any flawed updates for added peace of mind."
);
} )() }
</Text>
Expand Down

0 comments on commit 5e91c7e

Please sign in to comment.