Skip to content
Snippets Groups Projects
Commit 6c253c3c authored by Marcelo Schmidt's avatar Marcelo Schmidt
Browse files

Merge branch 'develop' into channel-settings

* develop:

Conflicts:
	client/views/app/message.coffee
parents dabd419e 43e62c80
No related branches found
No related tags found
No related merge requests found
Template.message.helpers
actions: ->
return RocketChat.MessageAction.getButtons(this)
own: ->
return 'own' if this.u?._id is Meteor.userId()
chatops: ->
return 'chatops-message' if this.u?.username is RocketChat.settings.get('Chatops_Username')
time: ->
return moment(this.ts).format('HH:mm')
date: ->
return moment(this.ts).format('LL')
isTemp: ->
if @temp is true
return 'temp'
return
body: ->
return Template.instance().body
......@@ -30,8 +23,8 @@ Template.message.helpers
return Template.instance().wasEdited
editTime: ->
return "" unless Template.instance().wasEdited
moment(@editedAt).format('LL hh:mma') #TODO profile pref for 12hr/24hr clock?
if Template.instance().wasEdited
return moment(@editedAt).format('LL hh:mma') #TODO profile pref for 12hr/24hr clock?
editedBy: ->
return "" unless Template.instance().wasEdited
# try to return the username of the editor,
......@@ -85,30 +78,32 @@ Template.message.onCreated ->
@wasEdited = msg.editedAt? and not RocketChat.MessageTypes.isSystemMessage(msg)
@body = do ->
switch msg.t
when 'r' then t('Room_name_changed', { room_name: msg.msg, user_by: msg.u.username })
when 'au' then t('User_added_by', { user_added: msg.msg, user_by: msg.u.username })
when 'ru' then t('User_removed_by', { user_removed: msg.msg, user_by: msg.u.username })
when 'ul' then t('User_left', { user_left: msg.u.username })
when 'nu' then t('User_added', { user_added: msg.u.username })
when 'uj' then t('User_joined_channel', { user: msg.u.username })
when 'wm' then t('Welcome', { user: msg.u.username })
when 'rm' then t('Message_removed', { user: msg.u.username })
when 'rtc' then RocketChat.callbacks.run 'renderRtcMessage', msg
messageType = RocketChat.MessageTypes.getType(msg)
if messageType?.render?
return messageType.render(message)
else if messageType?.template?
# render template
else if messageType?.message?
if messageType.data?(msg)?
return TAPi18n.__(messageType.message, messageType.data(msg))
else
if msg.u?.username is RocketChat.settings.get('Chatops_Username')
msg.html = msg.msg
message = RocketChat.callbacks.run 'renderMentions', msg
# console.log JSON.stringify message
return msg.html
return TAPi18n.__(messageType.message)
else
if msg.u?.username is RocketChat.settings.get('Chatops_Username')
msg.html = msg.msg
if _.trim(msg.html) isnt ''
msg.html = _.escapeHTML msg.html
message = RocketChat.callbacks.run 'renderMessage', msg
message = RocketChat.callbacks.run 'renderMentions', msg
# console.log JSON.stringify message
msg.html = message.html.replace /\n/gm, '<br/>'
return msg.html
msg.html = msg.msg
if _.trim(msg.html) isnt ''
msg.html = _.escapeHTML msg.html
message = RocketChat.callbacks.run 'renderMessage', msg
# console.log JSON.stringify message
msg.html = message.html.replace /\n/gm, '<br/>'
return msg.html
Template.message.onViewRendered = (context) ->
view = this
this._domrange.onAttached (domRange) ->
......
......@@ -9,16 +9,10 @@
class="time">
{{time}}
</span>
<span
class="edited"
title='{{_ "edited"}} at {{editTime}} {{_ "by"}} {{editedBy}}'>
<span class="edited" title='{{_ "edited"}} at {{editTime}} {{_ "by"}} {{editedBy}}'>
<i class="icon-edit"></i>
{{_ "by"}}
<a
class="thumb thumb-small user-card-message"
href="#"
data-username="{{editedBy}}"
tabindex="1">
<a class="thumb thumb-small user-card-message" href="#" data-username="{{editedBy}}" tabindex="1">
{{> avatar username=editedBy}}
</a>
</span>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment