diff --git a/client/lib/RoomManager.coffee b/client/lib/RoomManager.coffee index 67b7a68753410..9ff08ad9ff9d5 100644 --- a/client/lib/RoomManager.coffee +++ b/client/lib/RoomManager.coffee @@ -51,7 +51,7 @@ ready: false if myRoomActivity.ready() - if ChatSubscription.findOne { rid: roomId, uid: Meteor.userId() }, { reactive: false } + if ChatSubscription.findOne { rid: roomId, 'u._id': Meteor.userId() }, { reactive: false } openedRooms[roomId].active = true setRoomExpireExcept roomId computation.invalidate() diff --git a/client/lib/UserManager.coffee b/client/lib/UserManager.coffee index be3dcfd4a8377..463d29257bf29 100644 --- a/client/lib/UserManager.coffee +++ b/client/lib/UserManager.coffee @@ -3,12 +3,12 @@ dep = new Tracker.Dependency - addUser = (userIds) -> - # console.log 'addUser', userIds if window.rocketUserDebug - userIds = [].concat userIds - for userId in userIds - unless users[userId] - users[userId] = 1 + addUser = (usernames) -> + # console.log 'addUser', usernames if window.rocketUserDebug + usernames = [].concat usernames + for username in usernames + unless users[username] + users[username] = 1 dep.changed() subscribeFn = -> @@ -21,7 +21,7 @@ dep.depend() subscribe.run() - init() + # init() addUser: addUser users: users diff --git a/client/lib/chatMessages.coffee b/client/lib/chatMessages.coffee index 99d59037324da..cbd9dbc0a9853 100644 --- a/client/lib/chatMessages.coffee +++ b/client/lib/chatMessages.coffee @@ -61,7 +61,7 @@ self.typingTimeout = null startEditingLastMessage = (rid, imput) -> - lastMessage = ChatMessage.findOne { rid: rid, t: {$exists: false}, uid: Meteor.userId() }, { sort: { ts: -1 } } + lastMessage = ChatMessage.findOne { rid: rid, t: {$exists: false}, 'u._id': Meteor.userId() }, { sort: { ts: -1 } } if not lastMessage? return diff --git a/client/methods/leaveRoom.coffee b/client/methods/leaveRoom.coffee index 728bb75b3d217..fe1d6676affb0 100644 --- a/client/methods/leaveRoom.coffee +++ b/client/methods/leaveRoom.coffee @@ -4,8 +4,8 @@ Meteor.methods update = $pull: - uids: Meteor.userId() + usernames: Meteor.user().username - ChatSubscription.remove { rid: roomId, uid: Meteor.userId() } + ChatSubscription.remove { rid: roomId, 'u._id': Meteor.userId() } ChatRoom.update roomId, update diff --git a/client/methods/sendMessage.coffee b/client/methods/sendMessage.coffee index 4cee976d5d004..958ffaf165553 100644 --- a/client/methods/sendMessage.coffee +++ b/client/methods/sendMessage.coffee @@ -3,10 +3,11 @@ Meteor.methods Tracker.nonreactive -> now = new Date(Date.now() + TimeSync.serverOffset()) - ChatMessage.upsert { rid: msg.rid, uid: Meteor.userId(), t: 't' }, + ChatMessage.upsert { rid: msg.rid, t: 't' }, $set: ts: now msg: msg.message + 'u.username': Meteor.user().username $unset: t: 1 expireAt: 1 @@ -15,7 +16,7 @@ Meteor.methods Tracker.nonreactive -> now = new Date(Date.now() + TimeSync.serverOffset()) - ChatMessage.update { _id: msg.id, uid: Meteor.userId() }, + ChatMessage.update { _id: msg.id, 'u._id': Meteor.userId() }, $set: ets: now msg: msg.message diff --git a/client/methods/typingStatus.coffee b/client/methods/typingStatus.coffee index 8d2536819f5e1..fdff0694957bb 100644 --- a/client/methods/typingStatus.coffee +++ b/client/methods/typingStatus.coffee @@ -6,7 +6,7 @@ Meteor.methods filter = t: 't' rid: typingData.rid - uid: Meteor.userId() + $and: [{'u._id': Meteor.userId()}] if start msgData = @@ -14,6 +14,8 @@ Meteor.methods expireAt: moment().add(30, 'seconds').toDate() '$setOnInsert': msg: '...' + 'u._id': Meteor.userId() + 'u.username': Meteor.user().username ts: moment().add(1, 'years').toDate() ChatMessage.upsert(filter, msgData) diff --git a/client/startup/startup.coffee b/client/startup/startup.coffee index 7d8410368c796..19766ff021c3e 100644 --- a/client/startup/startup.coffee +++ b/client/startup/startup.coffee @@ -2,7 +2,7 @@ Meteor.startup -> UserPresence.awayTime = 300000 UserPresence.start() - Session.setDefault('AvatarRandom', Date.now()) + Session.setDefault('AvatarRandom', 0) window.lastMessageWindow = {} window.lastMessageWindowHistory = {} @@ -26,42 +26,33 @@ Meteor.startup -> TAPi18n.setLanguage(userLanguage) moment.locale(userLanguage) - Meteor.users.find({}, { fields: { name: 1, pictures: 1, status: 1, emails: 1, phone: 1, services: 1 } }).observe + Meteor.users.find({}, { fields: { name: 1, username: 1, pictures: 1, status: 1, emails: 1, phone: 1, services: 1 } }).observe added: (user) -> - Session.set('user_' + user._id + '_name', user.name) - Session.set('user_' + user._id + '_status', user.status) - Session.set('user_' + user._id + '_emails', user.emails) - Session.set('user_' + user._id + '_phone', user.phone) + Session.set('user_' + user.username + '_status', user.status) - UserAndRoom.insert({ type: 'u', uid: user._id, name: user.name}) + # UserAndRoom.insert({ type: 'u', uid: user._id, username: user.username, name: user.name}) changed: (user) -> - Session.set('user_' + user._id + '_name', user.name) - Session.set('user_' + user._id + '_status', user.status) - Session.set('user_' + user._id + '_emails', user.emails) - Session.set('user_' + user._id + '_phone', user.phone) + Session.set('user_' + user.username + '_status', user.status) - UserAndRoom.update({ uid: user._id }, { $set: { name: user.name } }) + # UserAndRoom.update({ uid: user._id }, { $set: { username: user.username, name: user.name } }) removed: (user) -> - Session.set('user_' + user._id + '_name', null) - Session.set('user_' + user._id + '_status', null) - Session.set('user_' + user._id + '_emails', null) - Session.set('user_' + user._id + '_phone', null) + Session.set('user_' + user.username + '_status', null) - UserAndRoom.remove({ uid: user._id }) + # UserAndRoom.remove({ uid: user._id }) - ChatRoom.find({ t: { $ne: 'd' } }, { fields: { t: 1, name: 1 } }).observe - added: (room) -> - roomData = { type: 'r', t: room.t, rid: room._id, name: room.name } + # ChatRoom.find({ t: { $ne: 'd' } }, { fields: { t: 1, name: 1 } }).observe + # added: (room) -> + # roomData = { type: 'r', t: room.t, rid: room._id, name: room.name } - UserAndRoom.insert(roomData) - changed: (room) -> - UserAndRoom.update({ rid: room._id }, { $set: { t: room.t, name: room.name } }) - removed: (room) -> - UserAndRoom.remove({ rid: room._id }) + # UserAndRoom.insert(roomData) + # changed: (room) -> + # UserAndRoom.update({ rid: room._id }, { $set: { t: room.t, name: room.name } }) + # removed: (room) -> + # UserAndRoom.remove({ rid: room._id }) Tracker.autorun -> rooms = [] - ChatSubscription.find({ uid: Meteor.userId() }, { fields: { rid: 1 } }).forEach (sub) -> + ChatSubscription.find({ 'u._id': Meteor.userId() }, { fields: { rid: 1 } }).forEach (sub) -> rooms.push sub.rid ChatRoom.find({ _id: $in: rooms }).observe diff --git a/client/stylesheets/base.less b/client/stylesheets/base.less index 9fc6449340cff..332d436dbf9d0 100644 --- a/client/stylesheets/base.less +++ b/client/stylesheets/base.less @@ -269,7 +269,7 @@ input.search { } } -form.search-form { +.search-form { position: relative; } @@ -668,8 +668,8 @@ a.github-fork { .avatar-image { height: 100%; width: 100%; - min-height: 40px; - min-width: 40px; + min-height: 20px; + min-width: 20px; display: block; background-color: transparent; background-size: cover; @@ -2069,7 +2069,7 @@ a.github-fork { } } -@user-image-square: 40px; +@user-image-square: 30px; .user-image { margin: 4px; height: @user-image-square; @@ -2146,7 +2146,7 @@ a.github-fork { a{ .cf_; padding: 5px 0; - height: auto; + height: 30px; background-color: transparent; display: block; > div{ diff --git a/client/views/app/chatMessageDashboard.coffee b/client/views/app/chatMessageDashboard.coffee index 698df19f780f4..94b7fe40566b9 100644 --- a/client/views/app/chatMessageDashboard.coffee +++ b/client/views/app/chatMessageDashboard.coffee @@ -1,10 +1,9 @@ Template.chatMessageDashboard.helpers own: -> - return 'own' if this.data.uid is Meteor.userId() + return 'own' if this.data.u?._id is Meteor.userId() username: -> - if this.uid? - return Session.get('user_' + this.uid + '_name') + return this.u.username isSystemMessage: -> return this.t in ['s', 'p', 'f', 'r', 'au', 'ru', 'ul', 'nu', 'wm'] @@ -30,8 +29,8 @@ Template.chatMessageDashboard.helpers message: -> if this.by UserManager.addUser(this.by) - else if this.uid - UserManager.addUser(this.uid) + else if this.u?.username + UserManager.addUser this.u.username switch this.t when 'p' then "#{this.msg}" when 'r' then t('chatMessageDashboard.Room_name_changed', { room_name: this.msg, user_by: Session.get('user_' + this.by + '_name') }) + '.' @@ -76,10 +75,9 @@ Template.chatMessageDashboard.events Meteor.defer -> $('.input-message-editing').select() - # TODO open flextab with user info - # 'click .mention-link': -> - # Session.set('flexOpened', true) - # Session.set('showUserInfo', $(e.currentTarget).data('username')) + 'click .mention-link': (e) -> + Session.set('flexOpened', true) + Session.set('showUserInfo', $(e.currentTarget).data('username')) Template.chatMessageDashboard.onRendered -> chatMessages = $('.messages-box .wrapper') diff --git a/client/views/app/chatMessageDashboard.html b/client/views/app/chatMessageDashboard.html index 1d4e3ea90ff52..ed85d434fbf11 100644 --- a/client/views/app/chatMessageDashboard.html +++ b/client/views/app/chatMessageDashboard.html @@ -4,10 +4,10 @@ {{#if isSystemMessage}}

{{{message}}}

{{else}} - - {{> avatar userId=uid}} + + {{> avatar username=username}} - {{username}} + {{username}} {{time}} {{#if ets}} diff --git a/client/views/app/chatWindowDashboard.coffee b/client/views/app/chatWindowDashboard.coffee index e6577083f54e6..87d196462ee22 100644 --- a/client/views/app/chatWindowDashboard.coffee +++ b/client/views/app/chatWindowDashboard.coffee @@ -6,7 +6,7 @@ Template.chatWindowDashboard.helpers return t('chatWindowDashboard.Quick_Search') favorite: -> console.log 'chatWindowDashboard.favorite' if window.rocketDebug - sub = ChatSubscription.findOne { rid: this._id, uid: Meteor.userId() } + sub = ChatSubscription.findOne { rid: this._id, 'u._id': Meteor.userId() } return 'icon-star favorite-room' if sub?.f? and sub.f return 'icon-star-empty' @@ -37,7 +37,7 @@ Template.chatWindowDashboard.helpers typing: -> console.log 'chatWindowDashboard.typing' if window.rocketDebug - return this.uid isnt Meteor.userId() + return this.u._id isnt Meteor.userId() usersTyping: -> messages = ChatMessage.find { rid: this._id }, { sort: { ts: 1 } } @@ -45,10 +45,10 @@ Template.chatWindowDashboard.helpers selfTyping = false messages.forEach (message) -> if message.t is 't' - if message.uid is Meteor.userId() + if message.u._id is Meteor.userId() selfTyping = true else - username = Session.get('user_' + message.uid + '_name') + username = message.u.username if username? usernames.push username @@ -142,14 +142,14 @@ Template.chatWindowDashboard.helpers return {} unless roomData if roomData.t is 'd' - uid = _.without roomData.uids, Meteor.userId() - UserManager.addUser uid + username = _.without roomData.usernames, Meteor.user().username + UserManager.addUser username userData = { - name: Session.get('user_' + uid + '_name') - emails: Session.get('user_' + uid + '_emails') || [] - phone: Session.get('user_' + uid + '_phone') - uid: String(uid) + name: Session.get('user_' + username + '_name') + emails: Session.get('user_' + username + '_emails') || [] + phone: Session.get('user_' + username + '_phone') + username: String(username) } return userData @@ -201,14 +201,14 @@ Template.chatWindowDashboard.helpers return '' unless roomData - return roomData.t in ['p', 'c'] and roomData.uid is Meteor.userId() + return roomData.t in ['p', 'c'] and roomData.u?._id is Meteor.userId() canEditName: -> roomData = Session.get('roomData' + this._id) return '' unless roomData - return roomData.uid is Meteor.userId() and roomData.t in ['c', 'p'] + return roomData.u?._id is Meteor.userId() and roomData.t in ['c', 'p'] roomNameEdit: -> return Session.get('roomData' + this._id)?.name @@ -237,43 +237,33 @@ Template.chatWindowDashboard.helpers room = ChatRoom.findOne(this._id, { reactive: false }) return room?.t in ['c', 'p'] + userActiveByUsername: (username) -> + status = Session.get 'user_' + username + '_status' + if status in ['online', 'away', 'busy'] + return {username: username, status: status} + return + roomUsers: -> room = ChatRoom.findOne(this._id, { reactive: false }) ret = _id: this._id - total: room?.uids.length + total: room?.usernames.length totalOnline: 0 - users: [] - - if room?.uids - # UserManager.addUser room.uids - - filter = - _id: - $in: room?.uids - - # unless Template.instance().showUsersOffline.get() - # filter.status = { $ne: 'offline' } - - filter.$and = [{ status: {$exists: true} }, { status: {$ne: 'offline'} }] - - users = Meteor.users.find(filter, { sort: { name: 1 } } ).fetch() - ret.totalOnline = users.length - ret.users = users + users: room.usernames return ret flexUserInfo: -> - uid = Session.get('showUserInfo') + username = Session.get('showUserInfo') userData = { - name: Session.get('user_' + uid + '_name') - emails: Session.get('user_' + uid + '_emails') - uid: String(uid) + # name: Session.get('user_' + uid + '_name') + # emails: Session.get('user_' + uid + '_emails') + username: String(username) } - phone = Session.get('user_' + uid + '_phone') - if phone? and phone[0]?.phoneNumber - userData.phone = phone[0]?.phoneNumber + # phone = Session.get('user_' + uid + '_phone') + # if phone? and phone[0]?.phoneNumber + # userData.phone = phone[0]?.phoneNumber return userData @@ -363,13 +353,13 @@ Template.chatWindowDashboard.events "click .flex-tab .user-image > a" : (e) -> Session.set('flexOpened', true) - Session.set('showUserInfo', $(e.currentTarget).data('userid')) + Session.set('showUserInfo', $(e.currentTarget).data('username')) 'click .user-card-message': (e) -> roomData = Session.get('roomData' + this.rid) if roomData.t in ['c', 'p'] Session.set('flexOpened', true) - Session.set('showUserInfo', $(e.currentTarget).data('userid')) + Session.set('showUserInfo', $(e.currentTarget).data('username')) else Session.set('flexOpened', true) @@ -381,7 +371,7 @@ Template.chatWindowDashboard.events if error return Errors.throw error.reason - if result.rid? + if result?.rid? Router.go('room', { _id: result.rid }) 'click button.load-more': (e) -> @@ -391,21 +381,20 @@ Template.chatWindowDashboard.events roomData = Session.get('roomData' + Session.get('openedRoom')) if roomData.t is 'd' - Meteor.call 'createGroupRoom', roomData.uids, doc.uid, (error, result) -> + Meteor.call 'createGroupRoom', roomData.usernames, doc.username, (error, result) -> if error return Errors.throw error.reason if result?.rid? - Router.go('room', { _id: result.rid }) + # Router.go('room', { _id: result.rid }) $('#user-add-search').val('') else if roomData.t in ['c', 'p'] - Meteor.call 'addUserToRoom', { rid: roomData._id, uid: doc.uid }, (error, result) -> + Meteor.call 'addUserToRoom', { rid: roomData._id, username: doc.username }, (error, result) -> if error return Errors.throw error.reason - if result - $('#user-add-search').val('') - toggleAddUser() + $('#user-add-search').val('') + toggleAddUser() 'autocompleteselect #room-search': (event, template, doc) -> if doc.type is 'u' @@ -438,7 +427,7 @@ Template.chatWindowDashboard.onCreated -> this.scrollOnBottom = true this.showUsersOffline = new ReactiveVar false - # this.subscribe("allUsers") + this.subscribe("allUsers") Template.chatWindowDashboard.onRendered -> FlexTab.check() diff --git a/client/views/app/chatWindowDashboard.html b/client/views/app/chatWindowDashboard.html index 86bf6735a2a03..854846a4e6e07 100644 --- a/client/views/app/chatWindowDashboard.html +++ b/client/views/app/chatWindowDashboard.html @@ -86,12 +86,12 @@

{{#if canAddUser}} -
+
- +
{{else}} {{#if isChannel}}
@@ -116,7 +116,14 @@

{{_ "chatWindowDashboard.Members_List"}}

{{/with}} @@ -125,10 +132,10 @@

{{_ "chatWindowDashboard.Members_List"}}

{{#with flexUserInfo}}
- {{> avatar userId=uid}} + {{> avatar username=username}}
-

{{name}}

+

{{username}}

{{#if contactCode}}
{{_ "general.Contact"}} {{contactCode}}
{{/if}} @@ -153,10 +160,10 @@

{{name}}

{{#with userData}}
- {{> avatar userId=uid}} + {{> avatar username=username}}
-

{{name}}

+

{{username}}

{{#if contactCode}}
{{_ "general.contact"}} {{contactCode}}
{{/if}} diff --git a/client/views/app/sideNav/channels.coffee b/client/views/app/sideNav/channels.coffee index 1e445ba0a50f4..982dc1392cde2 100644 --- a/client/views/app/sideNav/channels.coffee +++ b/client/views/app/sideNav/channels.coffee @@ -3,10 +3,10 @@ Template.channels.helpers return t('chatRooms.Members_placeholder') rooms: -> - return ChatSubscription.find { uid: Meteor.userId(), t: { $in: ['c']}, f: { $ne: true } }, { sort: 't': 1, 'rn': 1 } + return ChatSubscription.find { 'u._id': Meteor.userId(), t: { $in: ['c']}, f: { $ne: true } }, { sort: 't': 1, 'rn': 1 } total: -> - return ChatSubscription.find({ uid: Meteor.userId(), t: { $in: ['c']}, f: { $ne: true } }, { sort: 't': 1, 'rn': 1 }).fetch().length + return ChatSubscription.find({ 'u._id': Meteor.userId(), t: { $in: ['c']}, f: { $ne: true } }, { sort: 't': 1, 'rn': 1 }).count() Template.channels.events 'click .add-room': (e, instance) -> diff --git a/client/views/app/sideNav/chatRoomItem.coffee b/client/views/app/sideNav/chatRoomItem.coffee index f327b2ba53b89..d87326a7e9e32 100644 --- a/client/views/app/sideNav/chatRoomItem.coffee +++ b/client/views/app/sideNav/chatRoomItem.coffee @@ -11,8 +11,9 @@ Template.chatRoomItem.helpers userStatus: -> switch this.t when 'd' - uid = this.rid.replace Meteor.userId(), '' - return 'status-' + Session.get('user_' + uid + '_status') + username = this.rid.replace Meteor.user().username, '' + UserManager.addUser username + return 'status-' + Session.get('user_' + username + '_status') else return '' name: -> @@ -32,15 +33,15 @@ Template.chatRoomItem.helpers return false unless roomData - if (roomData.cl? and not roomData.cl) or roomData.t is 'd' or (roomData.uids.indexOf(Meteor.userId()) isnt -1 and roomData.uids.length is 1) + if (roomData.cl? and not roomData.cl) or roomData.t is 'd' or (roomData.usernames.indexOf(Meteor.user().username) isnt -1 and roomData.usernames.length is 1) return false else return true Template.chatRoomItem.rendered = -> if @data.t is 'd' - uid = @data.rid.replace Meteor.userId(), '' - UserManager.addUser uid + username = @data.rid.replace Meteor.user().username, '' + UserManager.addUser username if not (Router.current().params._id? and Router.current().params._id is this.data.rid) and (not this.data.ls? or moment(this.data.ls).add(1, 'days').startOf('day') < moment(this.data.ts).startOf('day')) KonchatNotification.newRoom(this.data.rid) diff --git a/client/views/app/sideNav/createChannelFlex.coffee b/client/views/app/sideNav/createChannelFlex.coffee index 8cdd2b83b0754..ffcfefe648048 100644 --- a/client/views/app/sideNav/createChannelFlex.coffee +++ b/client/views/app/sideNav/createChannelFlex.coffee @@ -28,7 +28,7 @@ Template.createChannelFlex.helpers type: 'u' $and: [ { _id: { $ne: Meteor.userId() } } - { _id: { $nin: Template.instance().selectedUsers.get() } } + { username: { $nin: Template.instance().selectedUsers.get() } } ] sort: 'name' } @@ -37,9 +37,9 @@ Template.createChannelFlex.helpers Template.createChannelFlex.events 'autocompleteselect #channel-members': (event, instance, doc) -> - instance.selectedUsers.set instance.selectedUsers.get().concat doc._id + instance.selectedUsers.set instance.selectedUsers.get().concat doc.username - instance.selectedUserNames[doc._id] = doc.name + instance.selectedUserNames[doc.username] = doc.name event.currentTarget.value = '' event.currentTarget.focus() diff --git a/client/views/app/sideNav/directMessages.coffee b/client/views/app/sideNav/directMessages.coffee index 415e04051d4de..20c419f423c9b 100644 --- a/client/views/app/sideNav/directMessages.coffee +++ b/client/views/app/sideNav/directMessages.coffee @@ -1,5 +1,5 @@ Template.directMessages.helpers rooms: -> - return ChatSubscription.find { uid: Meteor.userId(), t: { $in: ['d']}, f: { $ne: true } }, { sort: 't': 1, 'rn': 1 } + return ChatSubscription.find { 'u._id': Meteor.userId(), t: { $in: ['d']}, f: { $ne: true } }, { sort: 't': 1, 'rn': 1 } total: -> - return ChatSubscription.find({ uid: Meteor.userId(), t: { $in: ['d']}, f: { $ne: true } }, { sort: 't': 1, 'rn': 1 }).fetch().length + return ChatSubscription.find({ 'u._id': Meteor.userId(), t: { $in: ['d']}, f: { $ne: true } }, { sort: 't': 1, 'rn': 1 }).fetch().length diff --git a/client/views/app/sideNav/privateGroups.coffee b/client/views/app/sideNav/privateGroups.coffee index 5ba59860e380a..3a1a517001fa9 100644 --- a/client/views/app/sideNav/privateGroups.coffee +++ b/client/views/app/sideNav/privateGroups.coffee @@ -2,9 +2,9 @@ Template.privateGroups.helpers tRoomMembers: -> return t('chatRooms.Members_placeholder') rooms: -> - return ChatSubscription.find { uid: Meteor.userId(), t: { $in: ['p']}, f: { $ne: true } }, { sort: 't': 1, 'rn': 1 } + return ChatSubscription.find { 'u._id': Meteor.userId(), t: { $in: ['p']}, f: { $ne: true } }, { sort: 't': 1, 'rn': 1 } total: -> - return ChatSubscription.find({ uid: Meteor.userId(), t: { $in: ['p']}, f: { $ne: true } }, { sort: 't': 1, 'rn': 1 }).fetch().length + return ChatSubscription.find({ 'u._id': Meteor.userId(), t: { $in: ['p']}, f: { $ne: true } }, { sort: 't': 1, 'rn': 1 }).fetch().length Template.privateGroups.events 'click .add-room': (e, instance) -> diff --git a/client/views/app/sideNav/privateGroupsFlex.coffee b/client/views/app/sideNav/privateGroupsFlex.coffee index 4303c2a236285..0fce8645697ee 100644 --- a/client/views/app/sideNav/privateGroupsFlex.coffee +++ b/client/views/app/sideNav/privateGroupsFlex.coffee @@ -25,7 +25,7 @@ Template.privateGroupsFlex.helpers type: 'u' $and: [ { _id: { $ne: Meteor.userId() } } - { _id: { $nin: Template.instance().selectedUsers.get() } } + { username: { $nin: Template.instance().selectedUsers.get() } } ] sort: 'name' } @@ -34,9 +34,9 @@ Template.privateGroupsFlex.helpers Template.privateGroupsFlex.events 'autocompleteselect #pvt-group-members': (event, instance, doc) -> - instance.selectedUsers.set instance.selectedUsers.get().concat doc._id + instance.selectedUsers.set instance.selectedUsers.get().concat doc.username - instance.selectedUserNames[doc._id] = doc.name + instance.selectedUserNames[doc.username] = doc.name event.currentTarget.value = '' event.currentTarget.focus() diff --git a/client/views/app/sideNav/starredRooms.coffee b/client/views/app/sideNav/starredRooms.coffee index 22137ca040b87..5aa7be9d4d23a 100644 --- a/client/views/app/sideNav/starredRooms.coffee +++ b/client/views/app/sideNav/starredRooms.coffee @@ -1,5 +1,5 @@ Template.starredRooms.helpers rooms: -> - return ChatSubscription.find { uid: Meteor.userId(), f: true }, { sort: 't': 1, 'rn': 1 } + return ChatSubscription.find { 'u._id': Meteor.userId(), f: true }, { sort: 't': 1, 'rn': 1 } total: -> - return ChatSubscription.find({ uid: Meteor.userId(), f: true }, { sort: 't': 1, 'rn': 1 }).fetch().length \ No newline at end of file + return ChatSubscription.find({ 'u._id': Meteor.userId(), f: true }, { sort: 't': 1, 'rn': 1 }).fetch().length \ No newline at end of file diff --git a/client/views/app/sideNav/userStatus.coffee b/client/views/app/sideNav/userStatus.coffee index b77b17c466664..80cb1307f246e 100644 --- a/client/views/app/sideNav/userStatus.coffee +++ b/client/views/app/sideNav/userStatus.coffee @@ -1,7 +1,8 @@ Template.userStatus.helpers myUserInfo: -> visualStatus = "online" - switch Session.get('user_' + Meteor.userId() + '_status') + username = Meteor.user()?.username + switch Session.get('user_' + username + '_status') when "away" visualStatus = t("userStatus.away") when "busy" @@ -9,10 +10,11 @@ Template.userStatus.helpers when "offline" visualStatus = t("userStatus.invisible") return { - name: Session.get('user_' + Meteor.userId() + '_name') - status: Session.get('user_' + Meteor.userId() + '_status') + name: Session.get('user_' + username + '_name') + status: Session.get('user_' + username + '_status') visualStatus: visualStatus _id: Meteor.userId() + username: username } Template.userStatus.events diff --git a/client/views/app/sideNav/userStatus.html b/client/views/app/sideNav/userStatus.html index 9a920becc7818..4a574dbb5f284 100644 --- a/client/views/app/sideNav/userStatus.html +++ b/client/views/app/sideNav/userStatus.html @@ -2,13 +2,13 @@