mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 21:15:32 +09:00
feat(app): prompt to delete when clearing a message edit (#2687)
This commit is contained in:
1 parent
ab07fd23cf
commit
e490be2f35
48 files changed
+5228
-3724
No files matched your search
@@ -20,6 +20,7 @@ import {
|
||||
ExpressionAutocompleteControl,
|
||||
HideMutedChannelsByDefaultControl,
|
||||
InputButtonsControl,
|
||||
KeepAttachmentsOnEmptyEditAdvancedControl,
|
||||
MediaButtonsControl,
|
||||
MessageActionBarControl,
|
||||
PreuploadMessageAttachmentsControl,
|
||||
@@ -76,6 +77,7 @@ export const DIRECT_CONTROL_ITEM_IDS = new Set([
|
||||
'chat-settings-expression-autocomplete',
|
||||
'chat-settings-input-buttons',
|
||||
'chat-settings-convert-emoticons',
|
||||
'chat-settings-keep-attachments-on-empty-edit',
|
||||
'chat-settings-preupload-attachments',
|
||||
'chat-settings-sequential-file-send',
|
||||
'chat-settings-scroll-to-bottom-on-send',
|
||||
@@ -115,6 +117,7 @@ export const COMPACT_SWITCH_CONTROL_ITEM_IDS = new Set([
|
||||
'chat-settings-strip-tracking',
|
||||
'chat-settings-trust-domains',
|
||||
'chat-settings-convert-emoticons',
|
||||
'chat-settings-keep-attachments-on-empty-edit',
|
||||
'chat-settings-preupload-attachments',
|
||||
'chat-settings-sequential-file-send',
|
||||
'chat-settings-scroll-to-bottom-on-send',
|
||||
@@ -239,6 +242,10 @@ export const AdvancedSettingControl = observer(({item}: {item: SearchableSetting
|
||||
return (
|
||||
<ConvertEmoticonsAdvancedControl data-flx="user.advanced-setting-direct-controls.advanced-setting-control.convert-emoticons-advanced-control" />
|
||||
);
|
||||
case 'chat-settings-keep-attachments-on-empty-edit':
|
||||
return (
|
||||
<KeepAttachmentsOnEmptyEditAdvancedControl data-flx="user.advanced-setting-direct-controls.advanced-setting-control.keep-attachments-on-empty-edit-advanced-control" />
|
||||
);
|
||||
case 'chat-settings-preupload-attachments':
|
||||
return (
|
||||
<PreuploadMessageAttachmentsControl data-flx="user.advanced-setting-direct-controls.advanced-setting-control.preupload-message-attachments-control" />
|
||||
|
||||
+11
-1
@@ -16,7 +16,10 @@ import {SwitchGroup, SwitchGroupItem} from '@app/features/ui/components/SwitchGr
|
||||
import * as UserGuildSettingsCommands from '@app/features/user/commands/UserGuildSettingsCommands';
|
||||
import * as UserSettingsCommands from '@app/features/user/commands/UserSettingsCommands';
|
||||
import type {SearchEngineMode} from '@app/features/user/components/modals/tabs/chat_settings_tab/AddCustomSearchEngineModal';
|
||||
import {ConvertEmoticonsControl} from '@app/features/user/components/modals/tabs/chat_settings_tab/ChatSettingsTabInputTab';
|
||||
import {
|
||||
ConvertEmoticonsControl,
|
||||
KeepAttachmentsOnEmptyEditControl,
|
||||
} from '@app/features/user/components/modals/tabs/chat_settings_tab/ChatSettingsTabInputTab';
|
||||
import {
|
||||
StripTrackingParametersControl,
|
||||
TrustAllExternalLinksControl,
|
||||
@@ -280,6 +283,13 @@ export const ConvertEmoticonsAdvancedControl = observer(() => (
|
||||
<ConvertEmoticonsControl compact data-flx="user.advanced-settings-tab.convert-emoticons-control" />
|
||||
));
|
||||
|
||||
export const KeepAttachmentsOnEmptyEditAdvancedControl = observer(() => (
|
||||
<KeepAttachmentsOnEmptyEditControl
|
||||
compact
|
||||
data-flx="user.advanced-settings-tab.keep-attachments-on-empty-edit-control"
|
||||
/>
|
||||
));
|
||||
|
||||
interface SearchProviderSettingsModalProps {
|
||||
mode: SearchEngineMode;
|
||||
title: string;
|
||||
|
||||
+20
@@ -2,6 +2,7 @@
|
||||
|
||||
import ChatInputSettings from '@app/features/messaging/state/ChatInputSettings';
|
||||
import {Switch} from '@app/features/ui/components/form/FormSwitch';
|
||||
import AdvancedSettings from '@app/features/user/state/AdvancedSettings';
|
||||
import {msg} from '@lingui/core/macro';
|
||||
import {useLingui} from '@lingui/react/macro';
|
||||
import {observer} from 'mobx-react-lite';
|
||||
@@ -11,6 +12,10 @@ const CONVERT_EMOTICONS_TO_EMOJI_DESCRIPTOR = msg({
|
||||
message: 'Turn text smileys into emoji',
|
||||
comment: 'Label in the input tab.',
|
||||
});
|
||||
const KEEP_ATTACHMENTS_WHEN_CLEARING_AN_EDIT_DESCRIPTOR = msg({
|
||||
message: 'Keep attachments when clearing an edit',
|
||||
comment: 'Label for an advanced message editing preference.',
|
||||
});
|
||||
|
||||
interface InputSwitchControlProps {
|
||||
compact?: boolean;
|
||||
@@ -31,6 +36,21 @@ export const ConvertEmoticonsControl: React.FC<InputSwitchControlProps> = observ
|
||||
);
|
||||
});
|
||||
|
||||
export const KeepAttachmentsOnEmptyEditControl: React.FC<InputSwitchControlProps> = observer(({compact = false}) => {
|
||||
const {i18n} = useLingui();
|
||||
const label = i18n._(KEEP_ATTACHMENTS_WHEN_CLEARING_AN_EDIT_DESCRIPTOR);
|
||||
return (
|
||||
<Switch
|
||||
ariaLabel={label}
|
||||
label={compact ? undefined : label}
|
||||
value={AdvancedSettings.keepAttachmentsOnEmptyMessageEdit}
|
||||
onChange={AdvancedSettings.setKeepAttachmentsOnEmptyMessageEdit}
|
||||
compact={compact}
|
||||
data-flx="user.chat-settings-tab.input-tab.keep-attachments-on-empty-edit-control.switch"
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
||||
export const InputTabContent: React.FC = observer(() => {
|
||||
return <ConvertEmoticonsControl data-flx="user.chat-settings-tab.input-tab.input-tab-content.convert-emoticons" />;
|
||||
});
|
||||
+45
@@ -388,6 +388,34 @@ const REPLACE_COMMON_EMOTICONS_LIKE_SMILE_AND_HEART_DESCRIPTOR = msg({
|
||||
message: 'Swap common text faces such as :) and <3 for emoji when sending messages',
|
||||
comment: 'Settings search entry description. One-line summary of what the settings search entry controls.',
|
||||
});
|
||||
const KEEP_ATTACHMENTS_WHEN_CLEARING_AN_EDIT_DESCRIPTOR = msg({
|
||||
message: 'Keep attachments when clearing an edit',
|
||||
comment: 'Settings search entry label. Names the settings search entry in the settings UI.',
|
||||
});
|
||||
const EMPTY_EDIT_DESCRIPTOR = msg({
|
||||
message: 'Empty edit',
|
||||
comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',
|
||||
});
|
||||
const CLEAR_MESSAGE_TEXT_DESCRIPTOR = msg({
|
||||
message: 'Clear message text',
|
||||
comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',
|
||||
});
|
||||
const DELETE_PROMPT_DESCRIPTOR = msg({
|
||||
message: 'Delete prompt',
|
||||
comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',
|
||||
});
|
||||
const MESSAGE_EDITING_DESCRIPTOR = msg({
|
||||
message: 'Message editing',
|
||||
comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',
|
||||
});
|
||||
const KEEP_ATTACHMENTS_DESCRIPTOR = msg({
|
||||
message: 'Keep attachments',
|
||||
comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',
|
||||
});
|
||||
const CLEARING_THE_TEXT_OF_A_MESSAGE_WITH_ATTACHMENTS_ASKS_TO_DELETE_IT_DESCRIPTOR = msg({
|
||||
message: 'Clearing the text of a message with attachments asks to delete the message unless this is on',
|
||||
comment: 'Settings search entry description. One-line summary of what the settings search entry controls.',
|
||||
});
|
||||
const MESSAGE_INPUT_BUTTONS_DESCRIPTOR = msg({
|
||||
message: 'Message input buttons',
|
||||
comment: 'Settings search entry label. Names the settings search entry in the settings UI.',
|
||||
@@ -693,6 +721,23 @@ export const chatSettingsIndex: Array<SearchableSettingDescriptor> = [
|
||||
audience: 'primary',
|
||||
tags: ['chat'],
|
||||
},
|
||||
{
|
||||
id: 'chat-settings-keep-attachments-on-empty-edit',
|
||||
tabType: 'chat_settings',
|
||||
sectionId: 'input',
|
||||
label: KEEP_ATTACHMENTS_WHEN_CLEARING_AN_EDIT_DESCRIPTOR,
|
||||
keywords: [
|
||||
EMPTY_EDIT_DESCRIPTOR,
|
||||
CLEAR_MESSAGE_TEXT_DESCRIPTOR,
|
||||
DELETE_PROMPT_DESCRIPTOR,
|
||||
MESSAGE_EDITING_DESCRIPTOR,
|
||||
KEEP_ATTACHMENTS_DESCRIPTOR,
|
||||
],
|
||||
description: CLEARING_THE_TEXT_OF_A_MESSAGE_WITH_ATTACHMENTS_ASKS_TO_DELETE_IT_DESCRIPTOR,
|
||||
audience: 'advanced',
|
||||
tags: ['chat'],
|
||||
addedAt: '2026-09-11T00:00:00.000Z',
|
||||
},
|
||||
{
|
||||
id: 'chat-settings-scroll-to-bottom-on-send',
|
||||
tabType: 'chat_settings',
|
||||
|
||||
Reference in new issue
Block a user