From 45d89d1e44aaa84427491a86e0fa002bbd2fea2f Mon Sep 17 00:00:00 2001 From: Daniel Gasienica Date: Sat, 14 Apr 2018 20:09:11 -0400 Subject: [PATCH] Create `UserMessage` type Describes user visible messages that can have attachments. --- .../media-gallery/AttachmentListSection.tsx | 8 ++++++-- .../conversation/media-gallery/propTypes/Message.tsx | 1 - .../components/media-gallery/groupMessagesByDate.ts | 11 ----------- ts/types/Message.ts | 3 ++- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/ts/components/conversation/media-gallery/AttachmentListSection.tsx b/ts/components/conversation/media-gallery/AttachmentListSection.tsx index 3a013f6d6..003275230 100644 --- a/ts/components/conversation/media-gallery/AttachmentListSection.tsx +++ b/ts/components/conversation/media-gallery/AttachmentListSection.tsx @@ -44,12 +44,16 @@ export class AttachmentListSection extends React.Component { switch (type) { case 'media': return ( - + ); case 'documents': return ( ({ - id: date.toUTCString(), received_at: date.getTime(), attachments: [], }); @@ -44,12 +43,10 @@ describe('groupMessagesByDate', () => { type: 'today', messages: [ { - id: 'Thu, 12 Apr 2018 12:00:00 GMT', received_at: 1523534400000, attachments: [], }, { - id: 'Thu, 12 Apr 2018 00:01:00 GMT', received_at: 1523491260000, attachments: [], }, @@ -59,7 +56,6 @@ describe('groupMessagesByDate', () => { type: 'yesterday', messages: [ { - id: 'Wed, 11 Apr 2018 23:59:00 GMT', received_at: 1523491140000, attachments: [], }, @@ -69,7 +65,6 @@ describe('groupMessagesByDate', () => { type: 'thisWeek', messages: [ { - id: 'Mon, 09 Apr 2018 00:01:00 GMT', received_at: 1523232060000, attachments: [], }, @@ -79,12 +74,10 @@ describe('groupMessagesByDate', () => { type: 'thisMonth', messages: [ { - id: 'Sun, 08 Apr 2018 23:59:00 GMT', received_at: 1523231940000, attachments: [], }, { - id: 'Sun, 01 Apr 2018 00:01:00 GMT', received_at: 1522540860000, attachments: [], }, @@ -96,12 +89,10 @@ describe('groupMessagesByDate', () => { month: 2, messages: [ { - id: 'Sat, 31 Mar 2018 23:59:00 GMT', received_at: 1522540740000, attachments: [], }, { - id: 'Thu, 01 Mar 2018 14:00:00 GMT', received_at: 1519912800000, attachments: [], }, @@ -113,12 +104,10 @@ describe('groupMessagesByDate', () => { month: 1, messages: [ { - id: 'Mon, 28 Feb 2011 23:59:00 GMT', received_at: 1298937540000, attachments: [], }, { - id: 'Tue, 01 Feb 2011 10:00:00 GMT', received_at: 1296554400000, attachments: [], }, diff --git a/ts/types/Message.ts b/ts/types/Message.ts index 0be206025..808f5cd12 100644 --- a/ts/types/Message.ts +++ b/ts/types/Message.ts @@ -4,7 +4,8 @@ import { Attachment } from './Attachment'; import { IndexableBoolean } from './IndexedDB'; -export type Message = IncomingMessage | OutgoingMessage | VerifiedChangeMessage; +export type Message = UserMessage | VerifiedChangeMessage; +export type UserMessage = IncomingMessage | OutgoingMessage; export type IncomingMessage = Readonly< {