Simplify about string logic
This commit is contained in:
parent
25d206e4f7
commit
c1b5811c39
3 changed files with 3 additions and 93 deletions
|
@ -36,7 +36,6 @@ import type { ShowToastAction } from '../state/ducks/toast';
|
|||
import { getEmojiData, unifiedToEmoji } from './emoji/lib';
|
||||
import { assertDev } from '../util/assert';
|
||||
import { missingCaseError } from '../util/missingCaseError';
|
||||
import { sanitizeAboutText } from '../util/getAboutText';
|
||||
import { ConfirmationDialog } from './ConfirmationDialog';
|
||||
import { ContextMenu } from './ContextMenu';
|
||||
import { UsernameLinkModalBody } from './UsernameLinkModalBody';
|
||||
|
@ -210,7 +209,6 @@ export function ProfileEditor({
|
|||
});
|
||||
const [isResettingUsername, setIsResettingUsername] = useState(false);
|
||||
const [isResettingUsernameLink, setIsResettingUsernameLink] = useState(false);
|
||||
const [isInvalidAboutText, setIsInvalidAboutText] = useState(false);
|
||||
|
||||
// Reset username edit state when leaving
|
||||
useEffect(() => {
|
||||
|
@ -497,14 +495,6 @@ export function ProfileEditor({
|
|||
<Button
|
||||
disabled={shouldDisableSave}
|
||||
onClick={() => {
|
||||
if (
|
||||
sanitizeAboutText(stagedProfile.aboutText) !==
|
||||
stagedProfile.aboutText
|
||||
) {
|
||||
setIsInvalidAboutText(true);
|
||||
return;
|
||||
}
|
||||
|
||||
setFullBio({
|
||||
aboutEmoji: stagedProfile.aboutEmoji,
|
||||
aboutText: stagedProfile.aboutText,
|
||||
|
@ -778,25 +768,6 @@ export function ProfileEditor({
|
|||
/>
|
||||
)}
|
||||
|
||||
{isInvalidAboutText && (
|
||||
<ConfirmationDialog
|
||||
dialogName="ProfileEditorModal.invalidAboutText"
|
||||
title={i18n('icu:ProfileEditor__invalid-about__title')}
|
||||
cancelButtonVariant={ButtonVariant.Primary}
|
||||
cancelText={i18n('icu:Confirmation--confirm')}
|
||||
i18n={i18n}
|
||||
onClose={() => {
|
||||
setStagedProfile(profileData => ({
|
||||
...profileData,
|
||||
aboutText: sanitizeAboutText(profileData?.aboutText),
|
||||
}));
|
||||
setIsInvalidAboutText(false);
|
||||
}}
|
||||
>
|
||||
{i18n('icu:ProfileEditor__invalid-about__body')}
|
||||
</ConfirmationDialog>
|
||||
)}
|
||||
|
||||
{isResettingUsernameLink && (
|
||||
<ConfirmationDialog
|
||||
i18n={i18n}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue