Skip to content

Commit 4e50477

Browse files
Merge branch 'master' into rate-limit
2 parents 55b00d8 + dbd48ac commit 4e50477

File tree

11 files changed

+56
-26
lines changed

11 files changed

+56
-26
lines changed

client/views/app/messagePopupConfig.coffee

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,27 @@ Template.messagePopupConfig.helpers
116116
getInput: self.getInput
117117
getFilter: (collection, filter) ->
118118
results = []
119+
120+
# show common used emojis, when use input a single ':'
121+
if filter == ''
122+
commonEmojis = [
123+
':laughing:',
124+
':smiley:',
125+
':sunglasses:',
126+
':wink:',
127+
':innocent:',
128+
':flushed:',
129+
':disappointed:',
130+
':cry:',
131+
':heart:',
132+
':broken_heart:'
133+
]
134+
for shortname in commonEmojis
135+
results.push
136+
_id: shortname
137+
data: collection[shortname]
138+
return results;
139+
119140
for shortname, data of collection
120141
if shortname.indexOf(filter) > -1
121142
results.push

client/views/app/room.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ Template.room.helpers
209209
return RocketChat.TabBar.getTemplate()
210210

211211
flexData: ->
212-
return RocketChat.TabBar.getData()
212+
return _.extend { rid: this._id }, RocketChat.TabBar.getData()
213213

214214
adminClass: ->
215215
return 'admin' if RocketChat.authz.hasRole(Meteor.userId(), 'admin')

client/views/app/tabBar/membersList.coffee

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,16 @@ Template.membersList.helpers
33
return t('Add_users')
44

55
isGroupChat: ->
6-
room = ChatRoom.findOne(Session.get('openedRoom'), { reactive: false })
7-
return room?.t in ['c', 'p']
6+
return ChatRoom.findOne(this.rid, { reactive: false })?.t in ['c', 'p']
87

98
isDirectChat: ->
10-
room = ChatRoom.findOne(Session.get('openedRoom'), { reactive: false })
11-
return room?.t is 'd'
9+
return ChatRoom.findOne(this.rid, { reactive: false })?.t is 'd'
1210

1311
roomUsers: ->
14-
room = ChatRoom.findOne(Session.get('openedRoom'), { reactive: false })
1512
users = []
1613
onlineUsers = RoomManager.onlineUsers.get()
1714

18-
for username in room?.usernames or []
15+
for username in ChatRoom.findOne(this.rid)?.usernames or []
1916
if onlineUsers[username]?
2017
utcOffset = onlineUsers[username]?.utcOffset
2118
if utcOffset?
@@ -32,15 +29,15 @@ Template.membersList.helpers
3229
users = _.sortBy users, 'username'
3330

3431
ret =
35-
_id: Session.get('openedRoom')
36-
total: room?.usernames?.length or 0
32+
_id: this.rid
33+
total: ChatRoom.findOne(this.rid)?.usernames?.length or 0
3734
totalOnline: users.length
3835
users: users
3936

4037
return ret
4138

4239
canAddUser: ->
43-
roomData = Session.get('roomData' + Session.get('openedRoom'))
40+
roomData = Session.get('roomData' + this._id)
4441
return '' unless roomData
4542
return roomData.t in ['p', 'c'] and roomData.u?._id is Meteor.userId()
4643

@@ -67,7 +64,7 @@ Template.membersList.helpers
6764
return Meteor.users.findOne({ username: String(username) }) or { username: String(username) }
6865

6966
showUserInfo: ->
70-
webrtc = WebRTC.getInstanceByRoomId(Session.get('openedRoom'))
67+
webrtc = WebRTC.getInstanceByRoomId(this.rid)
7168
videoActive = webrtc?.localUrl?.get()? or webrtc?.remoteItems?.get()?.length > 0
7269
return Session.get('showUserInfo') and not videoActive
7370

@@ -77,7 +74,8 @@ Template.membersList.events
7774
Session.set('showUserInfo', $(e.currentTarget).data('username'))
7875

7976
'autocompleteselect #user-add-search': (event, template, doc) ->
80-
roomData = Session.get('roomData' + Session.get('openedRoom'))
77+
78+
roomData = Session.get('roomData' + template.data.rid)
8179

8280
if roomData.t is 'd'
8381
Meteor.call 'createGroupRoom', roomData.usernames, doc.username, (error, result) ->

client/views/app/tabBar/uploadedFilesList.coffee

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ roomFiles = new Mongo.Collection 'room_files'
22

33
Template.uploadedFilesList.helpers
44
files: ->
5-
return roomFiles.find().fetch()
5+
return roomFiles.find({ rid: this.rid }).fetch()
66

77
hasFiles: ->
8-
return roomFiles.find().count() > 0
8+
return roomFiles.find({ rid: this.rid }).count() > 0
99

1010
getFileIcon: (type) ->
1111
if type.match(/^image\/.+$/)
@@ -23,11 +23,8 @@ Template.uploadedFilesList.events
2323
if $(e.currentTarget).siblings('.icon-picture').length
2424
e.preventDefault()
2525

26-
2726
Template.uploadedFilesList.onCreated ->
28-
instance = this
29-
this.autorun ->
30-
instance.subscribe 'roomFiles', Session.get('openedRoom')
27+
this.subscribe 'roomFiles', Template.currentData().rid
3128

3229
Template.uploadedFilesList.onRendered ->
3330
$('.room-files-swipebox').swipebox()

client/views/login/form.coffee

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Template.loginForm.helpers
4444

4545
loginTerms: ->
4646
return RocketChat.settings.get 'Layout_Login_Terms'
47-
47+
4848
Template.loginForm.events
4949
'submit #login-card': (event, instance) ->
5050
event.preventDefault()
@@ -98,7 +98,7 @@ Template.loginForm.events
9898
if error.error is 'no-valid-email'
9999
instance.state.set 'email-verification'
100100
else
101-
toastr.error error.reason
101+
toastr.error t 'User_not_found_or_incorrect_password'
102102
return
103103
FlowRouter.go 'index'
104104

i18n/en.i18n.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@
364364
"User_left_female" : "User <em>__user_left__</em> left.",
365365
"User_left_male" : "User <em>__user_left__</em> left.",
366366
"User_logged_out" : "User is logged out",
367+
"User_not_found_or_incorrect_password": "User not found or incorrect password",
367368
"User_removed_by" : "User <em>__user_removed__</em> removed by <em>__user_by__</em>.",
368369
"User_Settings" : "User Settings",
369370
"User_updated_successfully" : "User updated successfully",

packages/rocketchat-file/file.server.coffee

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ RocketChatFile.GridFS = class
9191
readStream: rs
9292
contentType: file.contentType
9393
length: file.length
94+
uploadDate: file.uploadDate
9495
}
9596

9697
deleteFile: (fileName) ->

packages/rocketchat-lib/client/Notifications.coffee

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ RocketChat.Notifications = new class
3737
@streamAll.on eventName, callback
3838

3939
onRoom: (room, eventName, callback) ->
40-
console.log 'onRoom'
4140
if @debug is true
4241
@streamRoom.on room, -> console.log "RocketChat.Notifications: onRoom #{room}", arguments
4342

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
Meteor.startup ->
22
RocketChat.callbacks.add 'enter-room', ->
3-
console.log 'adding tabbar'
43
RocketChat.TabBar.addButton({ id: 'starred-messages', i18nTitle: 'Starred_Messages', icon: 'icon-star', template: 'starredMessages', order: 3 })
54
, RocketChat.callbacks.priority.MEDIUM, 'enter-room-tabbar-star'

server/publications/roomFiles.coffee

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Meteor.publish 'roomFiles', (rid) ->
22
unless this.userId
33
return this.ready()
44

5-
console.log '[publish] roomFiles'.green, rid
5+
console.log '[publish] roomFiles '.green, rid
66

77
pub = this
88

@@ -14,6 +14,7 @@ Meteor.publish 'roomFiles', (rid) ->
1414
fileOptions =
1515
fields:
1616
_id: 1
17+
rid: 1
1718
name: 1
1819
type: 1
1920
url: 1
@@ -22,6 +23,12 @@ Meteor.publish 'roomFiles', (rid) ->
2223
added: (_id, record) ->
2324
pub.added('room_files', _id, record)
2425

26+
changed: (_id, record) ->
27+
pub.changed('room_files', _id, record)
28+
29+
removed: (_id, record) ->
30+
pub.removed('room_files', _id, record)
31+
2532
this.ready()
2633
this.onStop ->
2734
cursorFileListHandle.stop()

0 commit comments

Comments
 (0)