Skip to content

Commit

Permalink
Timeline: Resize message if any attachment is no longer pending
Browse files Browse the repository at this point in the history
  • Loading branch information
scottnonnenberg-signal authored and kenpowers-signal committed Sep 4, 2019
1 parent 93ee9ae commit dbc312e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 21 deletions.
9 changes: 0 additions & 9 deletions ts/shims/Whisper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
15 changes: 3 additions & 12 deletions ts/state/ducks/conversations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit dbc312e

Please sign in to comment.