Create UserMessage
type
Describes user visible messages that can have attachments.
This commit is contained in:
parent
2dc3877fd4
commit
45d89d1e44
4 changed files with 8 additions and 15 deletions
|
@ -44,12 +44,16 @@ export class AttachmentListSection extends React.Component<Props, {}> {
|
|||
switch (type) {
|
||||
case 'media':
|
||||
return (
|
||||
<ImageThumbnail key={message.id} i18n={i18n} message={message} />
|
||||
<ImageThumbnail
|
||||
key={message.received_at}
|
||||
i18n={i18n}
|
||||
message={message}
|
||||
/>
|
||||
);
|
||||
case 'documents':
|
||||
return (
|
||||
<DocumentListEntry
|
||||
key={message.id}
|
||||
key={message.received_at}
|
||||
i18n={i18n}
|
||||
fileSize={firstAttachment.size}
|
||||
fileName={firstAttachment.fileName}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
* @prettier
|
||||
*/
|
||||
export interface Message {
|
||||
id: string;
|
||||
body?: string;
|
||||
received_at: number;
|
||||
attachments: Array<{
|
||||
|
|
|
@ -13,7 +13,6 @@ import {
|
|||
import { Message } from '../../../components/conversation/media-gallery/propTypes/Message';
|
||||
|
||||
const toMessage = (date: Date): Message => ({
|
||||
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: [],
|
||||
},
|
||||
|
|
|
@ -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<
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue