From 8cc2cd658197a183a6f5aecf4bff21782ce12ab3 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Wed, 2 Dec 2020 16:20:47 +1100 Subject: [PATCH] rename textPending to bodyPending not even sure we need it for Session this is used when the users sends a really large body => it is sent as an attachment --- js/models/messages.d.ts | 5 +++++ js/models/messages.js | 2 +- ts/components/conversation/Message.tsx | 12 ++++++------ ts/components/conversation/MessageBody.tsx | 10 +++++----- .../conversation/SessionCompositionBox.tsx | 15 --------------- 5 files changed, 17 insertions(+), 27 deletions(-) diff --git a/js/models/messages.d.ts b/js/models/messages.d.ts index 6e4ad17b4..e3837a8ad 100644 --- a/js/models/messages.d.ts +++ b/js/models/messages.d.ts @@ -1,3 +1,5 @@ +import { ConversationModel } from './conversations'; + type MessageModelType = 'incoming' | 'outgoing'; type MessageDeliveryStatus = | 'sending' @@ -56,6 +58,9 @@ export interface MessageModel extends Backbone.Model { isUnread: () => boolean; commit: () => Promise; getPropsForMessageDetail: () => any; + getConversation: () => ConversationModel; + handleMessageSentSuccess: (sentMessage: any, wrappedEnvelope: any) => any; + handleMessageSentFailure: (sentMessage: any, error: any) => any; propsForMessage?: any; propsForTimerNotification?: any; diff --git a/js/models/messages.js b/js/models/messages.js index 7757c2a25..6e20813bd 100644 --- a/js/models/messages.js +++ b/js/models/messages.js @@ -577,7 +577,7 @@ return { text: this.createNonBreakingLastSeparator(this.get('body')), - textPending: this.get('bodyPending'), + bodyPending: this.get('bodyPending'), id: this.id, direction: this.isIncoming() ? 'incoming' : 'outgoing', timestamp: this.get('sent_at'), diff --git a/ts/components/conversation/Message.tsx b/ts/components/conversation/Message.tsx index c17ebe040..3d75104bb 100644 --- a/ts/components/conversation/Message.tsx +++ b/ts/components/conversation/Message.tsx @@ -55,7 +55,7 @@ export interface Props { isDeletable: boolean; isModerator?: boolean; text?: string; - textPending?: boolean; + bodyPending?: boolean; id: string; collapseMetadata?: boolean; direction: 'incoming' | 'outgoing'; @@ -249,7 +249,7 @@ export class Message extends React.PureComponent { expirationTimestamp, status, text, - textPending, + bodyPending, timestamp, serverTimestamp, } = this.props; @@ -262,14 +262,14 @@ export class Message extends React.PureComponent { const withImageNoCaption = Boolean(!text && isShowingImage); const showError = status === 'error' && direction === 'outgoing'; const showSentNoErrors = - !textPending && + !bodyPending && direction === 'outgoing' && status !== 'error' && status !== 'sending' && status !== 'pow'; const showSending = - !textPending && + !bodyPending && direction === 'outgoing' && (status === 'sending' || status === 'pow'); return ( @@ -764,7 +764,7 @@ export class Message extends React.PureComponent { public renderText() { const { text, - textPending, + bodyPending, direction, status, isRss, @@ -796,7 +796,7 @@ export class Message extends React.PureComponent { text={contents || ''} isRss={isRss} i18n={window.i18n} - textPending={textPending} + bodyPending={bodyPending} isGroup={conversationType === 'group'} convoId={convoId} /> diff --git a/ts/components/conversation/MessageBody.tsx b/ts/components/conversation/MessageBody.tsx index 25ec357d1..403fdd6e3 100644 --- a/ts/components/conversation/MessageBody.tsx +++ b/ts/components/conversation/MessageBody.tsx @@ -11,7 +11,7 @@ import { LocalizerType, RenderTextCallbackType } from '../../types/Util'; interface Props { text: string; isRss?: boolean; - textPending?: boolean; + bodyPending?: boolean; /** If set, all emoji will be the same size. Otherwise, just one emoji will be large. */ disableJumbomoji?: boolean; /** If set, links will be left alone instead of turned into clickable `` tags. */ @@ -85,12 +85,12 @@ export class MessageBody extends React.Component { }; public addDownloading(jsx: JSX.Element): JSX.Element { - const { i18n, textPending } = this.props; + const { i18n, bodyPending } = this.props; return ( {jsx} - {textPending ? ( + {bodyPending ? ( {' '} {i18n('downloading')} @@ -103,7 +103,7 @@ export class MessageBody extends React.Component { public render() { const { text, - textPending, + bodyPending, disableJumbomoji, disableLinks, isRss, @@ -112,7 +112,7 @@ export class MessageBody extends React.Component { convoId, } = this.props; const sizeClass = disableJumbomoji ? undefined : getSizeClass(text); - const textWithPending = textPending ? `${text}...` : text; + const textWithPending = bodyPending ? `${text}...` : text; const emoji = renderEmoji({ i18n, diff --git a/ts/components/session/conversation/SessionCompositionBox.tsx b/ts/components/session/conversation/SessionCompositionBox.tsx index 397e75970..e7e0eeca9 100644 --- a/ts/components/session/conversation/SessionCompositionBox.tsx +++ b/ts/components/session/conversation/SessionCompositionBox.tsx @@ -628,22 +628,7 @@ export class SessionCompositionBox extends React.Component { } private onClickAttachment(attachment: AttachmentType) { - // const onSave = (caption: string) => { - // // eslint-disable-next-line no-param-reassign - // attachment.caption = caption; - // // this.captionEditorView.remove(); - // // Signal.Backbone.Views.Lightbox.hide(); - // this.render(); - // }; this.setState({ showCaptionEditor: attachment }); - - // this.captionEditorView = new Whisper.ReactWrapperView({ - // className: 'attachment-list-wrapper', - // Component: window.Signal.Components.CaptionEditor, - // props: getProps(), - // onClose: () => Signal.Backbone.Views.Lightbox.hide(), - // }); - // Signal.Backbone.Views.Lightbox.show(this.captionEditorView.el); } private renderCaptionEditor(attachment?: AttachmentType) {