chore(app): remove message scheduling and a dead descriptor (#2513)

This commit is contained in:
Hampus authored and GitHub committed 2026-09-06 15:35:36 +02:00
1 parent 43c778aae4
commit 1a5925f9cb
9 files changed
+1 -237

No files matched your search

@@ -28,10 +28,6 @@ const PER_COMMUNITY_PROFILES_DESCRIPTOR = msg({
message: 'Per-community profiles',
comment: 'Feature comparison table perk label. Shown as the row name comparing restricted vs stock limits.',
});
const MESSAGE_SCHEDULING_DESCRIPTOR = msg({
message: 'Message scheduling',
comment: 'Feature comparison table perk label. Shown as the row name comparing restricted vs stock limits.',
});
const PROFILE_BADGE_DESCRIPTOR = msg({
message: 'Profile badge',
comment: 'Feature comparison table perk label. Shown as the row name comparing restricted vs stock limits.',
@@ -96,7 +92,6 @@ export const FeatureComparisonTable = observer(() => {
() => ({
custom_4_digit_username_tag: i18n._(CUSTOM_USERNAME_TAG_DESCRIPTOR),
per_community_profiles: i18n._(PER_COMMUNITY_PROFILES_DESCRIPTOR),
message_scheduling: i18n._(MESSAGE_SCHEDULING_DESCRIPTOR),
profile_badge: i18n._(PROFILE_BADGE_DESCRIPTOR),
custom_video_backgrounds: i18n._(CUSTOM_VIDEO_BACKGROUNDS_DESCRIPTOR),
entrance_sounds: i18n._(ENTRANCE_SOUNDS_DESCRIPTOR),
@@ -59,7 +59,6 @@ export const Endpoints = {
CHANNEL_RECIPIENT: (channelId: string, userId: string) => `/channels/${channelId}/recipients/${userId}`,
CHANNEL_MESSAGES: (channelId: string) => `/channels/${channelId}/messages`,
CHANNEL_MESSAGES_BULK: '/channels/messages/bulk',
CHANNEL_MESSAGE_SCHEDULE: (channelId: string) => `/channels/${channelId}/messages/schedule`,
CHANNEL_MESSAGE: (channelId: string, messageId: string) => `/channels/${channelId}/messages/${messageId}`,
CHANNEL_MESSAGE_ATTACHMENT: (channelId: string, messageId: string, attachmentId: string) =>
`/channels/${channelId}/messages/${messageId}/attachments/${attachmentId}`,
@@ -210,8 +209,6 @@ export const Endpoints = {
USER_ENTRANCE_SOUND: (soundId: string) => `/users/@me/entrance-sounds/${soundId}`,
USER_ENTRANCE_SOUND_SELECTIONS: '/users/@me/entrance-sound-selections',
VOICE_CHANNEL_ENTRANCE_SOUND: (channelId: string) => `/voice/channels/${channelId}/entrance-sound`,
USER_SCHEDULED_MESSAGES: '/users/@me/scheduled-messages',
USER_SCHEDULED_MESSAGE: (messageId: string) => `/users/@me/scheduled-messages/${messageId}`,
USER_FAVORITE_MEMES: (query = ME) => `/users/${query}/memes`,
USER_FAVORITE_MEME: (query = ME, memeId: string) => `/users/${query}/memes/${memeId}`,
USER_FAVORITE_GIFS_RESOLVE: (query = ME) => `/users/${query}/favorite-gifs/resolve`,
@@ -21,16 +21,3 @@ export const OPEN_MENU_DESCRIPTOR = msg({
message: 'Open menu',
comment: 'Accessible label for the plus button that opens the textarea attachment and customization menu.',
});
export const RESCHEDULE_MESSAGE_DESCRIPTOR = msg({
message: 'Reschedule message',
comment: 'Title of the confirmation alert shown when editing a scheduled message to change the scheduled time.',
});
export const UPDATE_DESCRIPTOR = msg({
message: 'Update',
comment: 'Confirm button label on the reschedule scheduled-message alert.',
});
export const THIS_WILL_MODIFY_THE_EXISTING_SCHEDULED_MESSAGE_RATHER_DESCRIPTOR = msg({
message: 'This will modify the existing scheduled message rather than sending immediately.',
comment:
'Body of the reschedule scheduled-message alert clarifying that the update modifies the scheduled message instead of sending it now.',
});
@@ -648,10 +648,6 @@ export const NEVER_DESCRIPTOR = msg({
message: 'Never',
comment: 'Generic short option label for "never" in time / frequency dropdowns.',
});
export const NO_DESCRIPTION_PROVIDED_DESCRIPTOR = msg({
message: 'No description provided.',
comment: 'Generic short empty-state body shown when an entity has no description set.',
});
export const PINNED_DM_DESCRIPTOR = msg({
message: 'Pinned DM',
comment: 'Generic short toast / status label confirming a DM was pinned.',
@@ -1,147 +0,0 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import * as Modal from '@app/features/app/components/dialogs/Modal';
import {CANCEL_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';
import {Button} from '@app/features/ui/button/Button';
import {Combobox, type ComboboxOption} from '@app/features/ui/components/form/FormCombobox';
import {Input} from '@app/features/ui/components/form/FormInput';
import {MS_PER_DAY} from '@fluxer/date_utils/src/DateConstants';
import {getSystemTimeZone} from '@fluxer/date_utils/src/DateIntrospection';
import {msg} from '@lingui/core/macro';
import {useLingui} from '@lingui/react/macro';
import type React from 'react';
import {useCallback, useEffect, useMemo, useState} from 'react';
const SCHEDULE_MESSAGE_DESCRIPTOR = msg({
message: 'Schedule message',
comment: 'Title of the schedule-message modal.',
});
const PICK_A_TIME_WHEN_THIS_MESSAGE_SHOULD_BE_DESCRIPTOR = msg({
message: 'Pick a time when this message should be posted.',
comment: 'Helper text in the schedule-message modal explaining the action.',
});
const DATE_TIME_DESCRIPTOR = msg({
message: 'Date & time',
comment: 'Field label for the date and time picker in the schedule-message modal. The ampersand is intentional.',
});
const TIMEZONE_DESCRIPTOR = msg({
message: 'Timezone',
comment: 'Field label for the timezone picker in the schedule-message modal.',
});
const SCHEDULED_MESSAGES_CAN_BE_AT_MOST_30_DAYS_DESCRIPTOR = msg({
message: 'Scheduled messages can be at most 30 days in the future.',
comment:
'Inline validation message in the schedule-message modal when the picked time is more than 30 days away. Keep tone plain.',
});
const SCHEDULE_DESCRIPTOR = msg({
message: 'Schedule',
comment: 'Confirm button label in the schedule-message modal that saves the scheduled send.',
});
interface ScheduleMessageModalProps {
onClose: () => void;
onSubmit: (scheduledLocalAt: string, timezone: string) => Promise<void>;
initialScheduledLocalAt?: string;
initialTimezone?: string;
title?: string;
submitLabel?: string;
helpText?: React.ReactNode;
}
const formatInputValue = (value: Date): string => value.toISOString().slice(0, 16);
export const ScheduleMessageModal = ({
onClose,
onSubmit,
initialScheduledLocalAt,
initialTimezone,
title,
submitLabel,
helpText,
}: ScheduleMessageModalProps) => {
const {i18n} = useLingui();
const minDateTime = useMemo(() => formatInputValue(new Date(Date.now() + 60_000)), []);
const maxDateTime = useMemo(() => formatInputValue(new Date(Date.now() + 30 * MS_PER_DAY)), []);
const defaultTimezone = useMemo(() => getSystemTimeZone(), []);
const timezoneOptions = useMemo((): Array<ComboboxOption<string>> => {
const intl = Intl as typeof Intl & {supportedValuesOf?: (type: string) => Array<string>};
const zones = typeof intl.supportedValuesOf === 'function' ? intl.supportedValuesOf('timeZone') : [defaultTimezone];
return zones.map((zone) => ({value: zone, label: zone}));
}, [defaultTimezone]);
const initialScheduledAt = useMemo(
() => initialScheduledLocalAt ?? formatInputValue(new Date(Date.now() + 5 * 60 * 1000)),
[initialScheduledLocalAt],
);
const [scheduledLocalAt, setScheduledLocalAt] = useState(initialScheduledAt);
const [timezone, setTimezone] = useState(initialTimezone ?? defaultTimezone);
useEffect(() => {
setScheduledLocalAt(initialScheduledLocalAt ?? formatInputValue(new Date(Date.now() + 5 * 60 * 1000)));
}, [initialScheduledLocalAt]);
useEffect(() => {
if (initialTimezone) {
setTimezone(initialTimezone);
}
}, [initialTimezone]);
const [submitting, setSubmitting] = useState(false);
const handleConfirm = useCallback(async () => {
if (!scheduledLocalAt) {
return;
}
setSubmitting(true);
try {
await onSubmit(scheduledLocalAt, timezone);
onClose();
} finally {
setSubmitting(false);
}
}, [scheduledLocalAt, timezone, onSubmit, onClose]);
return (
<Modal.Root size="small" centered onClose={onClose} data-flx="messaging.schedule-message-modal.modal-root">
<Modal.Header
title={title ?? i18n._(SCHEDULE_MESSAGE_DESCRIPTOR)}
data-flx="messaging.schedule-message-modal.modal-header"
/>
<Modal.Content data-flx="messaging.schedule-message-modal.modal-content">
<Modal.ContentLayout data-flx="messaging.schedule-message-modal.modal-content-layout">
<Modal.Description data-flx="messaging.schedule-message-modal.modal-description">
{helpText ?? i18n._(PICK_A_TIME_WHEN_THIS_MESSAGE_SHOULD_BE_DESCRIPTOR)}
</Modal.Description>
<Modal.InputGroup data-flx="messaging.schedule-message-modal.modal-input-group">
<Input
id="schedule-message-time"
type="datetime-local"
label={i18n._(DATE_TIME_DESCRIPTOR)}
min={minDateTime}
max={maxDateTime}
value={scheduledLocalAt}
onChange={(event) => setScheduledLocalAt(event.target.value)}
data-flx="messaging.schedule-message-modal.schedule-message-time.set-scheduled-local-at.datetime-local"
/>
<Combobox
id="schedule-message-timezone"
label={i18n._(TIMEZONE_DESCRIPTOR)}
description={i18n._(SCHEDULED_MESSAGES_CAN_BE_AT_MOST_30_DAYS_DESCRIPTOR)}
value={timezone}
options={timezoneOptions}
onChange={setTimezone}
data-flx="messaging.schedule-message-modal.schedule-message-timezone.set-timezone"
/>
</Modal.InputGroup>
</Modal.ContentLayout>
</Modal.Content>
<Modal.Footer data-flx="messaging.schedule-message-modal.modal-footer">
<Button variant="secondary" onClick={onClose} data-flx="messaging.schedule-message-modal.button.close">
{i18n._(CANCEL_DESCRIPTOR)}
</Button>
<Button
variant="primary"
onClick={handleConfirm}
submitting={submitting}
disabled={!scheduledLocalAt}
data-flx="messaging.schedule-message-modal.button.confirm"
>
{submitLabel ?? i18n._(SCHEDULE_DESCRIPTOR)}
</Button>
</Modal.Footer>
</Modal.Root>
);
};
@@ -118,7 +118,7 @@ export const InboxPopout = observer(({initialTab}: {initialTab?: InboxTab} = {})
const readStateVersion = ReadStates.version;
const settingsVersion = UserGuildSettings.version;
const unreadChannels = useMemo(() => getUnreadChannels(), [readStateVersion, settingsVersion]);
const baseTabs: Array<TabConfig> = [
const tabs: Array<TabConfig> = [
{
key: 'unreadChannels',
label: i18n._(UNREAD_DESCRIPTOR),
@@ -135,7 +135,6 @@ export const InboxPopout = observer(({initialTab}: {initialTab?: InboxTab} = {})
icon: <AtIcon weight="bold" className={styles.iconSmall} data-flx="messaging.inbox-popout.icon-small--3" />,
},
];
const tabs = baseTabs;
const normalizedActiveTab = tabs.some((tab) => tab.key === activeTab) ? activeTab : tabs[0].key;
const setActiveTab = useCallback((tab: InboxTab) => {
InboxCommands.setTab(tab);