From dbc312e189cb545db071ff786133d30e7a735b2e Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Wed, 4 Sep 2019 14:11:30 -0700 Subject: [PATCH] Timeline: Resize message if any attachment is no longer pending --- ts/shims/Whisper.ts | 9 --------- ts/state/ducks/conversations.ts | 15 +++------------ 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/ts/shims/Whisper.ts b/ts/shims/Whisper.ts index 4250180b7..4d4a45f40 100644 --- a/ts/shims/Whisper.ts +++ b/ts/shims/Whisper.ts @@ -11,12 +11,3 @@ export function getBubbleProps(attributes: any) { return model.getPropsForBubble(); } - -export function isVoiceFlag(flags: any): boolean { - // @ts-ignore - const protoFlags = window.textsecure.protobuf.AttachmentPointer.Flags; - const VOICE_MESSAGE_FLAG = protoFlags.VOICE_MESSAGE; - - // tslint:disable-next-line no-bitwise - return Boolean(flags && flags & VOICE_MESSAGE_FLAG); -} diff --git a/ts/state/ducks/conversations.ts b/ts/state/ducks/conversations.ts index 0259f0a2e..a39eb86b4 100644 --- a/ts/state/ducks/conversations.ts +++ b/ts/state/ducks/conversations.ts @@ -10,13 +10,8 @@ import { without, } from 'lodash'; import { trigger } from '../../shims/events'; -import { isVoiceFlag } from '../../shims/Whisper'; import { NoopActionType } from './noop'; -import { - AttachmentType, - isImageAttachment, - isVideoAttachment, -} from '../../types/Attachment'; +import { AttachmentType } from '../../types/Attachment'; // State @@ -536,16 +531,12 @@ function hasMessageHeightChanged( return true; } - const singleVisualAttachmentNoLongerPending = - messageAttachments.length === 1 && + const firstAttachmentNoLongerPending = previousAttachments[0] && previousAttachments[0].pending && messageAttachments[0] && - (isImageAttachment(messageAttachments[0]) || - isVideoAttachment(messageAttachments[0]) || - isVoiceFlag(messageAttachments[0].flags)) && !messageAttachments[0].pending; - if (singleVisualAttachmentNoLongerPending) { + if (firstAttachmentNoLongerPending) { return true; }