reuse the code for getting the time a user joined
This commit is contained in:
parent
558c5efa1a
commit
dd4615f573
@ -20,6 +20,9 @@
|
||||
meet?.meetingName
|
||||
else null
|
||||
|
||||
@getTimeOfJoining = ->
|
||||
Meteor.Users.findOne({"user.userid": getInSession("userId")})?.user?.time_of_joining
|
||||
|
||||
# Finds the names of all people the current user is in a private conversation with
|
||||
# Removes yourself and duplicates if they exist
|
||||
@getPrivateChatees = ->
|
||||
|
@ -50,14 +50,14 @@ Template.chatbar.helpers
|
||||
after = before = greeting = []
|
||||
|
||||
if chattingWith is 'PUBLIC_CHAT' # find all public messages
|
||||
before = Meteor.Chat.find({'message.chat_type': chattingWith, 'message.from_time': {$lt: String(Meteor.Users.findOne({"user.userid": getInSession("userId")})?.user?.time_of_joining)}}).fetch()
|
||||
after = Meteor.Chat.find({'message.chat_type': chattingWith, 'message.from_time': {$gt: String(Meteor.Users.findOne({"user.userid": getInSession("userId")})?.user?.time_of_joining)}}).fetch()
|
||||
before = Meteor.Chat.find({'message.chat_type': chattingWith, 'message.from_time': {$lt: String(getTimeOfJoining())}}).fetch()
|
||||
after = Meteor.Chat.find({'message.chat_type': chattingWith, 'message.from_time': {$gt: String(getTimeOfJoining())}}).fetch()
|
||||
|
||||
greeting = [
|
||||
'message':
|
||||
'message': Template.chatbar.getChatGreeting(),
|
||||
'from_username': 'System',
|
||||
'from_time': Meteor.Users.findOne({"user.userid": getInSession("userId")})?.user?.time_of_joining
|
||||
'from_time': getTimeOfJoining()
|
||||
'from_color': '0x3399FF' # A nice blue in hex
|
||||
]
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user