The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/packages/rocketchat-lib/lib/Message.coffee

26 lines
869 B

RocketChat.Message =
parse: (msg, language) ->
messageType = RocketChat.MessageTypes.getType(msg)
if messageType?.render?
return messageType.render(msg)
else if messageType?.template?
# render template
else if messageType?.message?
if not language and localStorage?.getItem('userLanguage')
language = localStorage.getItem('userLanguage')
if messageType.data?(msg)?
return TAPi18n.__(messageType.message, messageType.data(msg), language)
else
return TAPi18n.__(messageType.message, {}, language)
else
if msg.u?.username is RocketChat.settings.get('Chatops_Username')
msg.html = msg.msg
return msg.html
msg.html = msg.msg
if _.trim(msg.html) isnt ''
msg.html = _.escapeHTML msg.html
# message = RocketChat.callbacks.run 'renderMessage', msg
msg.html = msg.html.replace /\n/gm, '<br/>'
return msg.html