Skip to content
Snippets Groups Projects
Commit db71f15e authored by Diego Sampaio's avatar Diego Sampaio
Browse files

fixes join channel and translation

parent 24de3515
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,7 @@ Template.chatMessageDashboard.helpers
return moment(date).format('LL')
isSystemMessage: ->
return this.t in ['s', 'p', 'f', 'r', 'au', 'ru', 'ul', 'nu', 'wm']
return this.t in ['s', 'p', 'f', 'r', 'au', 'ru', 'ul', 'nu', 'wm', 'uj']
isEditing: ->
return this._id is Session.get('editingMessageId')
......@@ -30,6 +30,7 @@ Template.chatMessageDashboard.helpers
when 'ul' then t('chatMessageDashboard.User_left', this.msg)
when 'nu' then t('chatMessageDashboard.User_added', this.msg)
when 'wm' then t('chatMessageDashboard.Welcome', this.msg)
when 'uj' then t('chatMessageDashboard.User_joined_channel', { user: this.msg })
else this.msg
time: ->
......
......@@ -15,13 +15,13 @@ Template.chatWindowDashboard.helpers
favorite: ->
console.log 'chatWindowDashboard.helpers favorite' if window.rocketDebug
sub = ChatSubscription.findOne { rid: this._id }
sub = ChatSubscription.findOne { rid: this._id }, { fields: { f: 1 } }
return 'icon-star favorite-room' if sub?.f? and sub.f
return 'icon-star-empty'
subscribed: ->
console.log 'chatWindowDashboard.helpers subscribed' if window.rocketDebug
return ChatSubscription.findOne { rid: this._id }
return ChatSubscription.find({ rid: this._id }).count() > 0
messages: ->
console.log 'chatWindowDashboard.helpers messages' if window.rocketDebug
......
......@@ -9,7 +9,9 @@
<i></i>
</div>
<h2>
<a href="#favorite" class="toggle-favorite"><i class="{{favorite}}"></i></a>
{{#if subscribed}}
<a href="#favorite" class="toggle-favorite"><i class="{{favorite}}"></i></a>
{{/if}}
<i class="{{roomTypeIcon}}"></i>
<span class="room-title {{editingTitle}}">{{roomName}}</span>
{{#if canEditName}}
......@@ -91,7 +93,7 @@
</form>
{{else}}
<div>
{{_ "chatWindowDashboard.you_are_in_preview_mode_of"}} <strong>#{{roomName}}</strong>
{{{_ "chatWindowDashboard.you_are_in_preview_mode_of" room_name=roomName}}}
<button class="button join"><span><i class="icon-login"></i> {{_ "chatWindowDashboard.join"}}</span></button>
</div>
{{/if}}
......
......@@ -11,7 +11,8 @@
"User_added_by" : "User <em>__user_added__</em> added by <em>__user_by__</em>.",
"User_left" : "User <em>%s</em> left.",
"User_removed_by" : "User <em>__user_removed__</em> removed by <em>__user_by__</em>.",
"Welcome" : "Welcome <em>%s</em>."
"Welcome" : "Welcome <em>%s</em>.",
"User_joined_channel" : "User <em>__user__</em> has joined the channel."
},
"chatRoomItem" : {
"Hide_room" : "Hide room",
......@@ -53,7 +54,7 @@
"Showing_online_users" : "Showing <b>__total_online__</b> of __total__ users",
"Start_of_conversation" : "Start of conversation",
"View_All" : "View All",
"you_are_in_preview_mode_of": "You are in preview mode of",
"you_are_in_preview_mode_of": "You are in preview mode of channel #<strong>__room_name__</strong>",
"join": "Join"
},
"footer" : {
......
......@@ -11,7 +11,8 @@
"User_added_by" : "Usuário <em>__user_added__</em> adicionado à conversa por <em>__user_by__</em>.",
"User_left" : "Usuário <em>%s</em> deixou a conversa.",
"User_removed_by" : "Usuário <em>__user_removed__</em> removido da conversa por <em>__user_by__</em>.",
"Welcome" : "Seja bem-vindo <em>%s</em>."
"Welcome" : "Seja bem-vindo <em>%s</em>.",
"User_joined_channel" : "Usuário <em>__user__</em> entrou no canal."
},
"chatRoomItem" : {
"Hide_room" : "Esconder sala",
......@@ -54,7 +55,9 @@
"Send_Message" : "Enviar Mensagem",
"Showing_online_users" : "Mostrando <b>__total_online__</b> de __total__ usuários",
"Start_of_conversation" : "Início da conversa",
"View_All" : "Ver Todos"
"View_All" : "Ver Todos",
"you_are_in_preview_mode_of": "Esta é uma prévia do canal #<strong>__room_name__</strong>",
"join": "Entrar"
},
"footer" : {
"Follow_social_profiles" : "Siga-nos nas redes sociais, faça fork no github e compartilhe suas ideias sobre o app rocket.chat em nosso trello.",
......@@ -164,4 +167,4 @@
"Use_uploaded_avatar" : "Use o avatar de upload",
"Select_file" : "Selecione um arquivo"
}
}
\ No newline at end of file
}
......@@ -7,22 +7,22 @@ Meteor.methods
throw new Meteor.Error 403, '[methods] joinRoom -> Not allowed'
# verify if user is already in room
# if room.usernames.indexOf(data.username) is -1
# if room.usernames.indexOf(user.username) is -1
now = new Date()
user = Meteor.users.findOne Meteor.userId()
update =
$push:
usernames:
$each: [data.username]
$each: [user.username]
$sort: 1
newUser = Meteor.users.findOne username: data.username
ChatRoom.update data.rid, update
ChatRoom.update rid, update
ChatSubscription.insert
rid: data.rid
rid: rid
ts: now
name: room.name
t: room.t
......@@ -30,16 +30,16 @@ Meteor.methods
alert: true
unread: 1
u:
_id: newUser._id
username: data.username
_id: user._id
username: user.username
ChatMessage.insert
rid: data.rid
rid: rid
ts: now
t: 'au'
msg: newUser.name
t: 'uj'
msg: user.name
u:
_id: newUser._id
username: data.username
_id: user._id
username: user.username
return true
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