From ccd41f6bdc72de909707a9d8770499ecde468ed7 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Fri, 7 Feb 2025 16:39:41 +1100 Subject: [PATCH] fix: hide banner until we can create new groups --- ts/components/conversation/SessionConversation.tsx | 5 ++++- .../conversation/header/ConversationHeader.tsx | 4 +++- ts/state/ducks/releasedFeatures.tsx | 11 ++++++++--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ts/components/conversation/SessionConversation.tsx b/ts/components/conversation/SessionConversation.tsx index e0623aba2..17d72465b 100644 --- a/ts/components/conversation/SessionConversation.tsx +++ b/ts/components/conversation/SessionConversation.tsx @@ -69,6 +69,7 @@ import { useSelectedWeAreAdmin, } from '../../state/selectors/selectedConversation'; import { useSelectedDisableLegacyGroupDeprecatedActions } from '../../hooks/useRefreshReleasedFeaturesTimestamp'; +import { useAreGroupsCreatedAsNewGroupsYet } from '../../state/selectors/releasedFeatures'; const DEFAULT_JPEG_QUALITY = 0.85; @@ -675,6 +676,8 @@ function OutdatedLegacyGroupBanner() { const isLegacyGroup = !isPrivate && !isPublic && selectedConversationKey && selectedConversationKey.startsWith('05'); + const newGroupsCanBeCreated = useAreGroupsCreatedAsNewGroupsYet(); + // FIXME change the date here. Remove after QA const text = deprecatedLegacyGroups ? localize( @@ -686,7 +689,7 @@ function OutdatedLegacyGroupBanner() { .withArgs({ date: '[Date]' }) .toString(); - return isLegacyGroup ? ( + return isLegacyGroup && newGroupsCanBeCreated ? ( { diff --git a/ts/components/conversation/header/ConversationHeader.tsx b/ts/components/conversation/header/ConversationHeader.tsx index fe4433d39..935c8fdce 100644 --- a/ts/components/conversation/header/ConversationHeader.tsx +++ b/ts/components/conversation/header/ConversationHeader.tsx @@ -25,6 +25,7 @@ import { groupInfoActions } from '../../../state/ducks/metaGroups'; import { updateConfirmModal } from '../../../state/ducks/modalDialog'; import { setLeftOverlayMode } from '../../../state/ducks/section'; import { SessionButtonColor, SessionButton } from '../../basic/SessionButton'; +import { useAreGroupsCreatedAsNewGroupsYet } from '../../../state/selectors/releasedFeatures'; export const ConversationHeaderWithDetails = () => { const isSelectionMode = useIsMessageSelectionMode(); @@ -121,8 +122,9 @@ function RecreateGroupButton() { const weAreAdmin = useSelectedWeAreAdmin(); const showRecreateGroupModal = useShowRecreateModal(); + const newGroupsCanBeCreated = useAreGroupsCreatedAsNewGroupsYet(); - if (!isLegacyGroup || !weAreAdmin) { + if (!isLegacyGroup || !weAreAdmin || !newGroupsCanBeCreated) { return null; } diff --git a/ts/state/ducks/releasedFeatures.tsx b/ts/state/ducks/releasedFeatures.tsx index ed83a1c7f..540afd694 100644 --- a/ts/state/ducks/releasedFeatures.tsx +++ b/ts/state/ducks/releasedFeatures.tsx @@ -4,11 +4,16 @@ import { DURATION } from '../../session/constants'; // update this to be when we ship desktop groups REMOVE AFTER QA const GROUP_DESKTOP_RELEASE = 1767225600 * 1000; // currently Thursday, January 1, 2026 12:00:00 AM -// FIXME update this to the correct timestamp REMOVE AFTER QA +/** + * 1 week after the release of groups (more or less), we force new groups to be created as new groups + */ export const START_CREATE_NEW_GROUP_TIMESTAMP_MS = GROUP_DESKTOP_RELEASE + DURATION.WEEKS * 1; -// FIXME update this to the correct timestamp REMOVE AFTER QA -export const LEGACY_GROUP_DEPRECATED_TIMESTAMP_MS = GROUP_DESKTOP_RELEASE + DURATION.WEEKS * 3; +/** + * 2 weeks after `START_CREATE_NEW_GROUP_TIMESTAMP_MS`, we mark legacy groups readonly + */ +export const LEGACY_GROUP_DEPRECATED_TIMESTAMP_MS = + START_CREATE_NEW_GROUP_TIMESTAMP_MS + DURATION.WEEKS * 2; export interface ReleasedFeaturesState { legacyGroupDeprecationTimestampRefreshAtMs: number;