mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2024-12-05 02:31:33 +00:00
Make message timestamps optional
This commit is contained in:
parent
ef4f467457
commit
f9ac60b270
@ -3,5 +3,5 @@
|
||||
|
||||
export class MessageMetadata {
|
||||
originator: string;
|
||||
timestamp: Date;
|
||||
timestamp?: Date;
|
||||
}
|
||||
|
@ -55,17 +55,24 @@ export class MessagesComponent implements OnInit {
|
||||
);
|
||||
}
|
||||
|
||||
writeMessage(data: MessagesMessage) {
|
||||
data.message = this.convert(data.message);
|
||||
this.messages.push(data);
|
||||
writeMessage(message: MessagesMessage) {
|
||||
this.transformMessage(message);
|
||||
this.messages.push(message);
|
||||
this.changeDetectorRef.detectChanges();
|
||||
}
|
||||
|
||||
transformMessage(message: MessagesMessage) {
|
||||
message.message = this.convertMarkdownToHTML(message.message);
|
||||
if (!message.timestamp) {
|
||||
message.timestamp = new Date();
|
||||
}
|
||||
}
|
||||
|
||||
handleQueueMessage(data: MessageQueueMessage) {
|
||||
this.messageQueueAttender.queueMessages(data.messages);
|
||||
}
|
||||
|
||||
convert(text: string) {
|
||||
convertMarkdownToHTML(text: string) {
|
||||
return this.markdownService.convertToHtml(text);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user