feat: show message timestamp

This commit is contained in:
Vlad Stan 2023-07-04 12:18:45 +03:00
parent acc6ed45c5
commit b6b86f5a02
2 changed files with 4 additions and 0 deletions

View file

@ -16,16 +16,19 @@ async function directMessages(path) {
computed: {
messagesAsJson: function () {
return this.messages.map(m => {
const dateFrom = moment(m.event_created_at * 1000).fromNow()
try {
const message = JSON.parse(m.message)
return {
isJson: message.type >= 0,
dateFrom,
...m,
message
}
} catch (error) {
return {
isJson: false,
dateFrom,
...m,
message: m.message
}