chore: move groups-related timestamps to constants.ts

pull/3281/head
Audric Ackermann 2 months ago
parent 634cd08109
commit d6dce706ff
No known key found for this signature in database

@ -99,9 +99,24 @@ export const REACT_LIMIT = 6;
export const UPDATER_INTERVAL_MS = 10 * DURATION.MINUTES;
// update this to be when we ship desktop groups REMOVE AFTER QA
const GROUP_DESKTOP_RELEASE = 1767225600000; // currently 1st Jan 2026
/**
* 3+7 days after the release of groups (more or less), we force new groups to be created as new groups
*/
const START_CREATE_NEW_GROUP = GROUP_DESKTOP_RELEASE + DURATION.DAYS * 10;
/**
* 2 weeks after `START_CREATE_NEW_GROUP`, we mark legacy groups readonly
*/
const LEGACY_GROUP_READONLY = START_CREATE_NEW_GROUP + DURATION.WEEKS * 2;
export const FEATURE_RELEASE_TIMESTAMPS = {
DISAPPEARING_MESSAGES_V2: 1710284400000, // 13/03/2024 10:00 Melbourne time
USER_CONFIG: 1690761600000, // Monday July 31st at 10am Melbourne time
START_CREATE_NEW_GROUP,
LEGACY_GROUP_READONLY,
};
export const ONBOARDING_TIMES = {

@ -1,20 +1,6 @@
import { createSlice, type PayloadAction } from '@reduxjs/toolkit';
import { DURATION } from '../../session/constants';
import { NetworkTime } from '../../util/NetworkTime';
// update this to be when we ship desktop groups REMOVE AFTER QA
const GROUP_DESKTOP_RELEASE = 1767225600 * 1000; // currently 1st Jan 2026
/**
* 3+7 days after the release of groups (more or less), we force new groups to be created as new groups
*/
const START_CREATE_NEW_GROUP_TIMESTAMP_MS = GROUP_DESKTOP_RELEASE + DURATION.DAYS * 10;
/**
* 2 weeks after `START_CREATE_NEW_GROUP_TIMESTAMP_MS`, we mark legacy groups readonly
*/
const LEGACY_GROUP_DEPRECATED_TIMESTAMP_MS =
START_CREATE_NEW_GROUP_TIMESTAMP_MS + DURATION.WEEKS * 2;
import { FEATURE_RELEASE_TIMESTAMPS } from '../../session/constants';
export interface ReleasedFeaturesState {
legacyGroupDeprecationTimestampRefreshAtMs: number;
@ -24,8 +10,8 @@ export interface ReleasedFeaturesState {
export const initialReleasedFeaturesState = {
legacyGroupDeprecationTimestampRefreshAtMs: Date.now(),
canCreateGroupV2: Date.now() >= START_CREATE_NEW_GROUP_TIMESTAMP_MS,
legacyGroupsReadOnly: Date.now() >= LEGACY_GROUP_DEPRECATED_TIMESTAMP_MS,
canCreateGroupV2: Date.now() >= FEATURE_RELEASE_TIMESTAMPS.START_CREATE_NEW_GROUP,
legacyGroupsReadOnly: Date.now() >= FEATURE_RELEASE_TIMESTAMPS.LEGACY_GROUP_READONLY,
};
const releasedFeaturesSlice = createSlice({
@ -34,8 +20,10 @@ const releasedFeaturesSlice = createSlice({
reducers: {
updateLegacyGroupDeprecationTimestampUpdatedAt: (state, action: PayloadAction<number>) => {
state.legacyGroupDeprecationTimestampRefreshAtMs = action.payload;
state.canCreateGroupV2 = NetworkTime.now() >= START_CREATE_NEW_GROUP_TIMESTAMP_MS;
state.legacyGroupsReadOnly = NetworkTime.now() >= LEGACY_GROUP_DEPRECATED_TIMESTAMP_MS;
state.canCreateGroupV2 =
NetworkTime.now() >= FEATURE_RELEASE_TIMESTAMPS.START_CREATE_NEW_GROUP;
state.legacyGroupsReadOnly =
NetworkTime.now() >= FEATURE_RELEASE_TIMESTAMPS.LEGACY_GROUP_READONLY;
return state;
},
},

Loading…
Cancel
Save