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