fix: check if content actually exists

chore: update lang submodule
This commit is contained in:
Paul Makles 2023-02-24 13:53:56 +01:00
parent 5b31ce494e
commit 21175dffda
No known key found for this signature in database
GPG key ID: 5059F398521BB0F6
2 changed files with 10 additions and 12 deletions

2
external/lang vendored

@ -1 +1 @@
Subproject commit 995fe65707cae9162b34d58ba0159e78d1b3e37e Subproject commit 7f87139f7962b55e90c1cfd50fbca64766b5886c

View file

@ -23,6 +23,7 @@ import {
} from "../../../lib/renderer/Singleton"; } from "../../../lib/renderer/Singleton";
import { state, useApplicationState } from "../../../mobx/State"; import { state, useApplicationState } from "../../../mobx/State";
import { DraftObject } from "../../../mobx/stores/Draft";
import { Reply } from "../../../mobx/stores/MessageQueue"; import { Reply } from "../../../mobx/stores/MessageQueue";
import { dayjs } from "../../../context/Locale"; import { dayjs } from "../../../context/Locale";
@ -45,8 +46,6 @@ import { PermissionTooltip } from "../Tooltip";
import FilePreview from "./bars/FilePreview"; import FilePreview from "./bars/FilePreview";
import ReplyBar from "./bars/ReplyBar"; import ReplyBar from "./bars/ReplyBar";
import { DraftObject } from "../../../mobx/stores/Draft";
type Props = { type Props = {
channel: Channel; channel: Channel;
}; };
@ -281,9 +280,9 @@ export default observer(({ channel }: Props) => {
const setMessage = useCallback( const setMessage = useCallback(
(content?: string) => { (content?: string) => {
const dobj: DraftObject = { const dobj: DraftObject = {
content content,
} };
state.draft.set(channel._id, dobj) state.draft.set(channel._id, dobj);
}, },
[state.draft, channel._id], [state.draft, channel._id],
); );
@ -615,12 +614,11 @@ export default observer(({ channel }: Props) => {
onSelect={(emoji) => { onSelect={(emoji) => {
const v = state.draft.get(channel._id); const v = state.draft.get(channel._id);
const cnt: DraftObject = { const cnt: DraftObject = {
content: (v == null ? "" : `${v.content} `) + `:${emoji}:` content:
} (v?.content ? `${v.content} ` : "") +
state.draft.set( `:${emoji}:`,
channel._id, };
cnt, state.draft.set(channel._id, cnt);
);
}} }}
onClose={closePicker} onClose={closePicker}
/> />