From 6fcdbd1cefa1227402651b12994f26a947c9e775 Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Sat, 21 May 2022 16:59:34 +0100 Subject: [PATCH] fix: remove explicit cast to string for `msg.content` --- external/lang | 2 +- src/components/common/messaging/Message.tsx | 7 +++++-- src/lib/ContextMenus.tsx | 2 +- src/pages/channels/messaging/MessageEditor.tsx | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/external/lang b/external/lang index bac88cff..9f9f1bf8 160000 --- a/external/lang +++ b/external/lang @@ -1 +1 @@ -Subproject commit bac88cffd196a2afacf7d726e4f7ef19bd6bd94c +Subproject commit 9f9f1bf8ee2ce099fec081a3aa2405c4c1d22678 diff --git a/src/components/common/messaging/Message.tsx b/src/components/common/messaging/Message.tsx index 032d3cb6..82928e8e 100644 --- a/src/components/common/messaging/Message.tsx +++ b/src/components/common/messaging/Message.tsx @@ -57,7 +57,7 @@ const Message = observer( const { openScreen } = useIntermediate(); - const content = message.content as string; + const content = message.content; const head = preferHead || (message.reply_ids && message.reply_ids.length > 0); @@ -168,7 +168,10 @@ const Message = observer( 0 || content.length > 0} + hasContent={ + index > 0 || + (content ? content.length > 0 : false) + } /> ))} {message.embeds?.map((embed, index) => ( diff --git a/src/lib/ContextMenus.tsx b/src/lib/ContextMenus.tsx index 2e38dfa9..6c1f134c 100644 --- a/src/lib/ContextMenus.tsx +++ b/src/lib/ContextMenus.tsx @@ -209,7 +209,7 @@ export default function ContextMenus() { .get(data.message.channel)! .sendMessage({ nonce: data.message.id, - content: data.message.data.content as string, + content: data.message.data.content, replies: data.message.data.replies, }) .catch(fail); diff --git a/src/pages/channels/messaging/MessageEditor.tsx b/src/pages/channels/messaging/MessageEditor.tsx index b137561d..8e64361a 100644 --- a/src/pages/channels/messaging/MessageEditor.tsx +++ b/src/pages/channels/messaging/MessageEditor.tsx @@ -48,7 +48,7 @@ interface Props { } export default function MessageEditor({ message, finish }: Props) { - const [content, setContent] = useState((message.content as string) ?? ""); + const [content, setContent] = useState(message.content ?? ""); const { focusTaken } = useContext(IntermediateContext); const { openScreen } = useIntermediate();