Merge pull request #2359 from ianmacd/pr33

Trim leading and trailing whitespace on message composition and display.
This commit is contained in:
Audric Ackermann 2022-07-11 15:44:19 +10:00 committed by GitHub
commit 354022f83d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -843,7 +843,7 @@ class CompositionBoxInner extends React.Component<Props, State> {
// this does not call call removeAllStagedAttachmentsInConvers
const { attachments, previews } = await this.getFiles(linkPreview);
this.props.sendMessage({
body: messagePlaintext,
body: messagePlaintext.trim(),
attachments: attachments || [],
quote: extractedQuotedMessageProps,
preview: previews,

View file

@ -31,7 +31,7 @@ export const MessageText = (props: Props) => {
? window.i18n('messageDeletedPlaceholder')
: direction === 'incoming' && status === 'error'
? window.i18n('incomingError')
: text;
: text?.trim();
if (!contents) {
return null;