From d2904f57aba5844a8b7cb33eeef59224fe26a87a Mon Sep 17 00:00:00 2001 From: Paul Date: Thu, 24 Jun 2021 17:09:34 +0100 Subject: [PATCH] Fix: Editor would not open "delete_message". Fix: Clear status if empty string given. --- src/context/intermediate/modals/Input.tsx | 2 +- src/pages/channels/messaging/MessageEditor.tsx | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/context/intermediate/modals/Input.tsx b/src/context/intermediate/modals/Input.tsx index b5897375..68e00937 100644 --- a/src/context/intermediate/modals/Input.tsx +++ b/src/context/intermediate/modals/Input.tsx @@ -119,7 +119,7 @@ export function SpecialInputModal(props: SpecialProps) { client.users.editUser({ status: { ...client.user?.status, - text + text: text.trim().length > 0 ? text : undefined } }) } diff --git a/src/pages/channels/messaging/MessageEditor.tsx b/src/pages/channels/messaging/MessageEditor.tsx index b46a10ab..e177736c 100644 --- a/src/pages/channels/messaging/MessageEditor.tsx +++ b/src/pages/channels/messaging/MessageEditor.tsx @@ -1,10 +1,10 @@ import styled from "styled-components"; -import { useContext, useEffect, useState } from "preact/hooks"; import TextAreaAutoSize from "../../../lib/TextAreaAutoSize"; import { MessageObject } from "../../../context/revoltjs/util"; +import { useContext, useEffect, useState } from "preact/hooks"; import { AppContext } from "../../../context/revoltjs/RevoltClient"; import { isTouchscreenDevice } from "../../../lib/isTouchscreenDevice"; -import { IntermediateContext } from "../../../context/intermediate/Intermediate"; +import { IntermediateContext, useIntermediate } from "../../../context/intermediate/Intermediate"; const EditorBase = styled.div` display: flex; @@ -40,6 +40,7 @@ interface Props { export default function MessageEditor({ message, finish }: Props) { const [ content, setContent ] = useState(message.content as string ?? ''); const { focusTaken } = useContext(IntermediateContext); + const { openScreen } = useIntermediate(); const client = useContext(AppContext); async function save() {