Add required Message.id: string
		
	This commit is contained in:
		
					parent
					
						
							
								dd7e51e697
							
						
					
				
			
			
				commit
				
					
						fca8de16c8
					
				
			
		
					 3 changed files with 14 additions and 2 deletions
				
			
		|  | @ -59,7 +59,7 @@ export class AttachmentSection extends React.Component<Props, {}> { | ||||||
|         case 'media': |         case 'media': | ||||||
|           return ( |           return ( | ||||||
|             <MediaGridItem |             <MediaGridItem | ||||||
|               key={message.received_at} |               key={message.id} | ||||||
|               message={message} |               message={message} | ||||||
|               onClick={onClick} |               onClick={onClick} | ||||||
|             /> |             /> | ||||||
|  | @ -67,7 +67,7 @@ export class AttachmentSection extends React.Component<Props, {}> { | ||||||
|         case 'documents': |         case 'documents': | ||||||
|           return ( |           return ( | ||||||
|             <DocumentListItem |             <DocumentListItem | ||||||
|               key={message.received_at} |               key={message.id} | ||||||
|               i18n={i18n} |               i18n={i18n} | ||||||
|               fileSize={firstAttachment.size} |               fileSize={firstAttachment.size} | ||||||
|               fileName={firstAttachment.fileName} |               fileName={firstAttachment.fileName} | ||||||
|  |  | ||||||
|  | @ -11,6 +11,7 @@ import { MapAsync } from '../../../../types/MapAsync'; | ||||||
| import { MIMEType } from '../../../../types/MIME'; | import { MIMEType } from '../../../../types/MIME'; | ||||||
| 
 | 
 | ||||||
| export type Message = { | export type Message = { | ||||||
|  |   id: string; | ||||||
|   attachments: Array<Attachment>; |   attachments: Array<Attachment>; | ||||||
|   received_at: number; |   received_at: number; | ||||||
| } & { objectURL?: string }; | } & { objectURL?: string }; | ||||||
|  |  | ||||||
|  | @ -13,6 +13,7 @@ import { | ||||||
| import { Message } from '../../../components/conversation/media-gallery/propTypes/Message'; | import { Message } from '../../../components/conversation/media-gallery/propTypes/Message'; | ||||||
| 
 | 
 | ||||||
| const toMessage = (date: Date): Message => ({ | const toMessage = (date: Date): Message => ({ | ||||||
|  |   id: date.toUTCString(), | ||||||
|   received_at: date.getTime(), |   received_at: date.getTime(), | ||||||
|   attachments: [], |   attachments: [], | ||||||
| }); | }); | ||||||
|  | @ -43,10 +44,12 @@ describe('groupMessagesByDate', () => { | ||||||
|         type: 'today', |         type: 'today', | ||||||
|         messages: [ |         messages: [ | ||||||
|           { |           { | ||||||
|  |             id: 'Thu, 12 Apr 2018 12:00:00 GMT', | ||||||
|             received_at: 1523534400000, |             received_at: 1523534400000, | ||||||
|             attachments: [], |             attachments: [], | ||||||
|           }, |           }, | ||||||
|           { |           { | ||||||
|  |             id: 'Thu, 12 Apr 2018 00:01:00 GMT', | ||||||
|             received_at: 1523491260000, |             received_at: 1523491260000, | ||||||
|             attachments: [], |             attachments: [], | ||||||
|           }, |           }, | ||||||
|  | @ -56,6 +59,7 @@ describe('groupMessagesByDate', () => { | ||||||
|         type: 'yesterday', |         type: 'yesterday', | ||||||
|         messages: [ |         messages: [ | ||||||
|           { |           { | ||||||
|  |             id: 'Wed, 11 Apr 2018 23:59:00 GMT', | ||||||
|             received_at: 1523491140000, |             received_at: 1523491140000, | ||||||
|             attachments: [], |             attachments: [], | ||||||
|           }, |           }, | ||||||
|  | @ -65,6 +69,7 @@ describe('groupMessagesByDate', () => { | ||||||
|         type: 'thisWeek', |         type: 'thisWeek', | ||||||
|         messages: [ |         messages: [ | ||||||
|           { |           { | ||||||
|  |             id: 'Mon, 09 Apr 2018 00:01:00 GMT', | ||||||
|             received_at: 1523232060000, |             received_at: 1523232060000, | ||||||
|             attachments: [], |             attachments: [], | ||||||
|           }, |           }, | ||||||
|  | @ -74,10 +79,12 @@ describe('groupMessagesByDate', () => { | ||||||
|         type: 'thisMonth', |         type: 'thisMonth', | ||||||
|         messages: [ |         messages: [ | ||||||
|           { |           { | ||||||
|  |             id: 'Sun, 08 Apr 2018 23:59:00 GMT', | ||||||
|             received_at: 1523231940000, |             received_at: 1523231940000, | ||||||
|             attachments: [], |             attachments: [], | ||||||
|           }, |           }, | ||||||
|           { |           { | ||||||
|  |             id: 'Sun, 01 Apr 2018 00:01:00 GMT', | ||||||
|             received_at: 1522540860000, |             received_at: 1522540860000, | ||||||
|             attachments: [], |             attachments: [], | ||||||
|           }, |           }, | ||||||
|  | @ -89,10 +96,12 @@ describe('groupMessagesByDate', () => { | ||||||
|         month: 2, |         month: 2, | ||||||
|         messages: [ |         messages: [ | ||||||
|           { |           { | ||||||
|  |             id: 'Sat, 31 Mar 2018 23:59:00 GMT', | ||||||
|             received_at: 1522540740000, |             received_at: 1522540740000, | ||||||
|             attachments: [], |             attachments: [], | ||||||
|           }, |           }, | ||||||
|           { |           { | ||||||
|  |             id: 'Thu, 01 Mar 2018 14:00:00 GMT', | ||||||
|             received_at: 1519912800000, |             received_at: 1519912800000, | ||||||
|             attachments: [], |             attachments: [], | ||||||
|           }, |           }, | ||||||
|  | @ -104,10 +113,12 @@ describe('groupMessagesByDate', () => { | ||||||
|         month: 1, |         month: 1, | ||||||
|         messages: [ |         messages: [ | ||||||
|           { |           { | ||||||
|  |             id: 'Mon, 28 Feb 2011 23:59:00 GMT', | ||||||
|             received_at: 1298937540000, |             received_at: 1298937540000, | ||||||
|             attachments: [], |             attachments: [], | ||||||
|           }, |           }, | ||||||
|           { |           { | ||||||
|  |             id: 'Tue, 01 Feb 2011 10:00:00 GMT', | ||||||
|             received_at: 1296554400000, |             received_at: 1296554400000, | ||||||
|             attachments: [], |             attachments: [], | ||||||
|           }, |           }, | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Daniel Gasienica
				Daniel Gasienica