Fix: Editor would not open "delete_message".

Fix: Clear status if empty string given.
This commit is contained in:
Paul 2021-06-24 17:09:34 +01:00
parent 1aa2b1226a
commit d2904f57ab
2 changed files with 4 additions and 3 deletions

View file

@ -119,7 +119,7 @@ export function SpecialInputModal(props: SpecialProps) {
client.users.editUser({
status: {
...client.user?.status,
text
text: text.trim().length > 0 ? text : undefined
}
})
}

View file

@ -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() {