@@ -537,34 +537,28 @@ export default {
537537 .on (' value' , snapshot => {
538538 if (! snapshot .val ()) return
539539
540- const foundUser = room .users .find (u => snapshot .key === u ._id )
540+ const timestampFormat = isSameDay (
541+ new Date (snapshot .val ().last_changed ),
542+ new Date ()
543+ )
544+ ? ' HH:mm'
545+ : ' DD MMMM, HH:mm'
541546
542- if (foundUser) {
543- const timestampFormat = isSameDay (
544- new Date (snapshot .val ().last_changed ),
545- new Date ()
546- )
547- ? ' HH:mm'
548- : ' DD MMMM, HH:mm'
547+ const timestamp = parseTimestamp (
548+ new Date (snapshot .val ().last_changed ),
549+ timestampFormat
550+ )
549551
550- const timestamp = parseTimestamp (
551- new Date (snapshot .val ().last_changed ),
552- timestampFormat
553- )
552+ const last_changed =
553+ timestampFormat === ' HH:mm' ? ` today, ${ timestamp} ` : timestamp
554554
555- const last_changed =
556- timestampFormat === ' HH:mm'
557- ? ` today, ${ timestamp} `
558- : timestamp
555+ user .status = { ... snapshot .val (), last_changed }
559556
560- user .status = { ... snapshot .val (), last_changed }
557+ const roomIndex = this .rooms .findIndex (
558+ r => room .roomId === r .roomId
559+ )
561560
562- const roomIndex = this .rooms .findIndex (
563- r => room .roomId === r .roomId
564- )
565-
566- this .$set (this .rooms , roomIndex, room)
567- }
561+ this .$set (this .rooms , roomIndex, room)
568562 })
569563 })
570564 })
0 commit comments