mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-31 21:21:03 -04:00
17 lines
503 B
CoffeeScript
17 lines
503 B
CoffeeScript
|
UserFormatter = require "../Users/UserFormatter"
|
||
|
|
||
|
module.exports = MessageFormatter =
|
||
|
formatMessageForClientSide: (message) ->
|
||
|
if message._id?
|
||
|
message.id = message._id.toString()
|
||
|
delete message._id
|
||
|
formattedMessage =
|
||
|
id: message.id
|
||
|
content: message.content
|
||
|
timestamp: message.timestamp
|
||
|
user: UserFormatter.formatUserForClientSide(message.user)
|
||
|
return formattedMessage
|
||
|
|
||
|
formatMessagesForClientSide: (messages) ->
|
||
|
(@formatMessageForClientSide(message) for message in messages)
|