Skip to content

Commit

Permalink
Merge branch 'master' of github.com:RocketChat/Rocket.Chat
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigok committed Aug 27, 2015
2 parents 714ae72 + 0b926b0 commit 59c2b01
Show file tree
Hide file tree
Showing 8 changed files with 161 additions and 124 deletions.
2 changes: 1 addition & 1 deletion client/lib/RoomManager.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Meteor.startup ->
if type in ['c', 'p']
query.name = name
else if type is 'd'
query.usernames = $all: [Meteor.user().username, name]
query.usernames = $all: [Meteor.user()?.username, name]

room = ChatRoom.findOne query, { reactive: false }

Expand Down
40 changes: 39 additions & 1 deletion client/stylesheets/base.less
Original file line number Diff line number Diff line change
Expand Up @@ -2839,7 +2839,45 @@ a.github-fork {
h3 {
font-size: 24px;
margin-bottom: 8px;
line-height: 22px;
line-height: 27px;
text-overflow: ellipsis;
width: 100%;
overflow: hidden;
white-space: nowrap;

i:after {
content: " ";
display: inline-block;
width: 8px;
height: 8px;
border-radius: 4px;
vertical-align: middle;
}

i.status-offline {
&:after {
border-color: darken(@status-offline, 5%);
background-color: @status-offline;
}
}
i.status-online {
&:after {
border-color: darken(@status-online, 5%);
background-color: @status-online;
}
}
i.status-away {
&:after {
border-color: darken(@status-away, 5%);
background-color: @status-away;
}
}
i.status-busy {
&:after {
border-color: darken(@status-busy, 5%);
background-color: @status-busy;
}
}
}
p {
line-height: 18px;
Expand Down
2 changes: 1 addition & 1 deletion client/stylesheets/global/_variables.less
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@
@info-font-color: #AAAAAA;

@status-online: #35AC19;
@status-offline: rgba(255, 255, 255, 0.35);
@status-offline: rgba(150, 150, 150, 0.50);
@status-busy: #D30230;
@status-away: #fcb316;
12 changes: 6 additions & 6 deletions client/views/admin/users/adminUsers.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Template.adminUsers.helpers
arrowPosition: ->
return 'left' unless Session.equals('flexOpened', true)
userData: ->
return Meteor.users.findOne Session.get 'adminUsersSelected'
return Meteor.users.findOne Session.get 'adminSelectedUser'
userChannels: ->
return ChatSubscription.find({ "u._id": Session.get 'adminUsersSelected' }, { fields: { rid: 1, name: 1, t: 1 }, sort: { t: 1, name: 1 } }).fetch()
return ChatSubscription.find({ "u._id": Session.get 'adminSelectedUser' }, { fields: { rid: 1, name: 1, t: 1 }, sort: { t: 1, name: 1 } }).fetch()
isLoading: ->
return 'btn-loading' unless Template.instance().ready?.get()
hasMore: ->
Expand Down Expand Up @@ -42,12 +42,12 @@ Template.adminUsers.onCreated ->
@autorun ->
filter = instance.filter.get()
limit = instance.limit.get()
subscription = instance.subscribe 'fullUsers', filter, limit
subscription = instance.subscribe 'fullUserData', filter, limit
instance.ready.set subscription.ready()

@autorun ->
if Session.get 'adminUsersSelected'
channelSubscription = instance.subscribe 'userChannels', Session.get 'adminUsersSelected'
if Session.get 'adminSelectedUser'
channelSubscription = instance.subscribe 'userChannels', Session.get 'adminSelectedUser'

@users = ->
filter = _.trim instance.filter?.get()
Expand Down Expand Up @@ -83,7 +83,7 @@ Template.adminUsers.events

'click .user-info': (e) ->
e.preventDefault()
Session.set 'adminUsersSelected', $(e.currentTarget).data('id')
Session.set 'adminSelectedUser', $(e.currentTarget).data('id')
Session.set 'flexOpened', true

'click .info-tabs a': (e) ->
Expand Down
19 changes: 5 additions & 14 deletions client/views/app/room.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,7 @@ Template.room.helpers

flexUserInfo: ->
username = Session.get('showUserInfo')

if Meteor.user()?.admin is true
userData = _.extend { username: String(username) }, Meteor.users.findOne { username: String(username) }
else
userData = {
username: String(username)
}

return userData
return Meteor.users.findOne({ username: String(username) }) or { username: String(username) }

userStatus: ->
roomData = Session.get('roomData' + this._id)
Expand Down Expand Up @@ -639,11 +631,10 @@ Template.room.onCreated ->
this.showUsersOffline = new ReactiveVar false
this.atBottom = true

# If current user is admin, subscribe to full user data
if Meteor.user()?.admin is true
Tracker.autorun ->
if Session.get('showUserInfo') and not Meteor.users.findOne Session.get 'showUserInfo'
Meteor.subscribe 'fullUsers', Session.get('showUserInfo'), 1
self = @

@autorun ->
self.subscribe 'fullUserData', Session.get('showUserInfo'), 1

Template.room.onRendered ->
FlexTab.check()
Expand Down
128 changes: 65 additions & 63 deletions client/views/app/userInfo.html
Original file line number Diff line number Diff line change
@@ -1,73 +1,75 @@
<template name="userInfo">
{{#with user}}
<div class="about clearfix">
{{#if ../video}}
{{#if videoActive}}
{{#if rtcLayout3}}
<div id='fullscreendiv' style="width: 100%">
<video id='videoremote' class="video-remote" src="{{remoteVideoUrl}}" style="width: 100%; align-items: center; margin-bottom: 10px; background-color: #000; transition: width 2s, height 2s, top 2s, left 2s, transform 2s;" autoplay></video>
<video id='videoself' class="video-self" src="{{selfVideoUrl}}" style="width: 250px; position: absolute; top: 21px; right: 31px; border: 1px solid #FFF; background-color: #000; transition: width 2s, height 2s, top 2s, left 2s, transform 2s;" autoplay muted></video>
</div>
{{/if}}
{{#if rtcLayout2}}
<div style="display: flex; flex-direction: row; align-items: center; width: 800px; height: 350px">
<video id="videoremote" class="video-remote" src="{{remoteVideoUrl}}" style="flex: 1 0; min-width: 380px; height: 285px; margin: 10px; background-color: #000;" autoplay></video>
<video id="videoself" class="video-self" src="{{selfVideoUrl}}" style="flex: 1 0; min-width: 380px; height: 285px; margin: 10px; background-color: #000;" autoplay muted></video>
</div>
{{/if}}
{{#if rtcLayout1}}
<div style="display: flex; flex-direction: column; align-items: center; width: 360px; height: 500px">
<video class="video-remote" src="{{remoteVideoUrl}}" style="flex: 1 1; width: 320px; margin: 10px; background-color: #000;" autoplay></video>
<video class="video-self" src="{{selfVideoUrl}}" style="flex: 1 1; width: 320px; margin: 10px; background-color: #000;" autoplay muted></video>
</div>
{{/if}}
{{#if noRtcLayout}}
<div>
<video class="video-remote" src="{{remoteVideoUrl}}" style="width: 100%; margin-bottom: 10px; background-color: #000; transition: width 2s, height 2s, top 2s, left 2s, transform 2s;" autoplay></video>
<video class="video-self" src="{{selfVideoUrl}}" style="width: 100px; position: absolute; top: 21px; right: 21px; border: 1px solid #FFF; background-color: #000; transition: width 2s, height 2s, top 2s, left 2s, transform 2s;" autoplay muted></video>
{{#if $.Session.get 'showUserInfo'}}
{{#with user}}
<div class="about clearfix">
{{#if ../video}}
{{#if videoActive}}
{{#if rtcLayout3}}
<div id='fullscreendiv' style="width: 100%">
<video id='videoremote' class="video-remote" src="{{remoteVideoUrl}}" style="width: 100%; align-items: center; margin-bottom: 10px; background-color: #000; transition: width 2s, height 2s, top 2s, left 2s, transform 2s;" autoplay></video>
<video id='videoself' class="video-self" src="{{selfVideoUrl}}" style="width: 250px; position: absolute; top: 21px; right: 31px; border: 1px solid #FFF; background-color: #000; transition: width 2s, height 2s, top 2s, left 2s, transform 2s;" autoplay muted></video>
</div>
{{/if}}
{{#if rtcLayout2}}
<div style="display: flex; flex-direction: row; align-items: center; width: 800px; height: 350px">
<video id="videoremote" class="video-remote" src="{{remoteVideoUrl}}" style="flex: 1 0; min-width: 380px; height: 285px; margin: 10px; background-color: #000;" autoplay></video>
<video id="videoself" class="video-self" src="{{selfVideoUrl}}" style="flex: 1 0; min-width: 380px; height: 285px; margin: 10px; background-color: #000;" autoplay muted></video>
</div>
{{/if}}
{{#if rtcLayout1}}
<div style="display: flex; flex-direction: column; align-items: center; width: 360px; height: 500px">
<video class="video-remote" src="{{remoteVideoUrl}}" style="flex: 1 1; width: 320px; margin: 10px; background-color: #000;" autoplay></video>
<video class="video-self" src="{{selfVideoUrl}}" style="flex: 1 1; width: 320px; margin: 10px; background-color: #000;" autoplay muted></video>
</div>
{{/if}}
{{#if noRtcLayout}}
<div>
<video class="video-remote" src="{{remoteVideoUrl}}" style="width: 100%; margin-bottom: 10px; background-color: #000; transition: width 2s, height 2s, top 2s, left 2s, transform 2s;" autoplay></video>
<video class="video-self" src="{{selfVideoUrl}}" style="width: 100px; position: absolute; top: 21px; right: 21px; border: 1px solid #FFF; background-color: #000; transition: width 2s, height 2s, top 2s, left 2s, transform 2s;" autoplay muted></video>
</div>
{{/if}}
{{/if}}
{{/if}}
{{/if}}
<div class="thumb">
{{> avatar username=username}}
</div>
<div class="info">
<h3>{{username}}</h3>
{{#if isAdmin}}
<div class="thumb">
{{> avatar username=username}}
</div>
<div class="info">
<h3 title="{{username}}"><i class="status-{{status}}"></i> {{username}}</h3>
<p>{{name}}</p>
{{#if utc}}<p><i class="icon-clock"></i>{{userTime}} (UTC {{utc}})</p>{{/if}}
{{#each emails}} <p><i class="icon-mail"></i> {{address}}{{#if verified}}&nbsp;<i class="icon-ok"></i>{{/if}}</p> {{/each}}
{{#each phone}} <p><i class="icon-phone"></i> {{phoneNumber}}</p> {{/each}}
{{#if lastLogin}} <p><i class="icon-calendar"></i> {{_ "Last_login"}}: {{lastLogin}}</p> {{/if}}
{{#if services.facebook.id}} <p><i class="icon-facebook"></i><a href="{{services.facebook.link}}" target="_blank">{{services.facebook.name}}</a></p> {{/if}}
{{#if services.github.id}} <p><i class="icon-github-circled"></i><a href="https://www.github.com/{{services.github.username}}" target="_blank">{{services.github.username}}</a></p> {{/if}}
{{#if services.gitlab.id}} <p><i class="icon-gitlab"></i>{{services.gitlab.username}}</p> {{/if}}
{{#if services.google.id}} <p><i class="icon-gplus"></i><a href="https://plus.google.com/{{services.google.id}}" target="_blank">{{services.google.name}}</a></p> {{/if}}
{{#if services.linkedin.id}} <p><i class="icon-linkedin"></i><a href="{{services.linkedin.publicProfileUrl}}" target="_blank">{{linkedinUsername}}</a></p> {{/if}}
{{#if servicesMeteor.id}} <p><i class="icon-meteor"></i>{{servicesMeteor.username}}</p> {{/if}}
{{#if services.twitter.id}} <p><i class="icon-twitter"></i><a href="https://twitter.com/{{services.twitter.screenName}}" target="_blank">{{services.twitter.screenName}}</a></p> {{/if}}
{{/if}}
{{#if isAdmin}}
{{#each emails}} <p><i class="icon-mail"></i> {{address}}{{#if verified}}&nbsp;<i class="icon-ok"></i>{{/if}}</p> {{/each}}
{{#each phone}} <p><i class="icon-phone"></i> {{phoneNumber}}</p> {{/each}}
{{#if lastLogin}} <p><i class="icon-calendar"></i> {{_ "Last_login"}}: {{lastLogin}}</p> {{/if}}
{{#if services.facebook.id}} <p><i class="icon-facebook"></i><a href="{{services.facebook.link}}" target="_blank">{{services.facebook.name}}</a></p> {{/if}}
{{#if services.github.id}} <p><i class="icon-github-circled"></i><a href="https://www.github.com/{{services.github.username}}" target="_blank">{{services.github.username}}</a></p> {{/if}}
{{#if services.gitlab.id}} <p><i class="icon-gitlab"></i>{{services.gitlab.username}}</p> {{/if}}
{{#if services.google.id}} <p><i class="icon-gplus"></i><a href="https://plus.google.com/{{services.google.id}}" target="_blank">{{services.google.name}}</a></p> {{/if}}
{{#if services.linkedin.id}} <p><i class="icon-linkedin"></i><a href="{{services.linkedin.publicProfileUrl}}" target="_blank">{{linkedinUsername}}</a></p> {{/if}}
{{#if servicesMeteor.id}} <p><i class="icon-meteor"></i>{{servicesMeteor.username}}</p> {{/if}}
{{#if services.twitter.id}} <p><i class="icon-twitter"></i><a href="https://twitter.com/{{services.twitter.screenName}}" target="_blank">{{services.twitter.screenName}}</a></p> {{/if}}
{{/if}}
</div>
</div>
</div>
{{/with}}
<nav>
{{#if video}}
{{#unless videoActive}}
<button class='button start-video'><span><i class='icon-videocam'></i> {{_ "Video_Chat"}}</span></button>
{{#if remoteMonitoring}}
<button class='button short monitor-video'><span><i class='icon-videocam'></i> {{_ "Remote"}}</span></button>
<button class='button lightblue setup-video'><span><i class='icon-videocam'></i> {{_ "Setup"}}</span></button>
{{/with}}
<nav>
{{#if video}}
{{#unless videoActive}}
<button class='button start-video'><span><i class='icon-videocam'></i> {{_ "Video_Chat"}}</span></button>
{{#if remoteMonitoring}}
<button class='button short monitor-video'><span><i class='icon-videocam'></i> {{_ "Remote"}}</span></button>
<button class='button lightblue setup-video'><span><i class='icon-videocam'></i> {{_ "Setup"}}</span></button>
{{/if}}
{{else}}
<button class='button red stop-video'><span><i class='icon-videocam'></i> {{_ "Stop_Video"}}</span></button>
{{/unless}}
{{/if}}
{{#if showAll}}
<button class='button secondary back'><span>{{_ "View_All"}} <i class='icon-angle-right'></i></span></button>
{{#if canDirectMessage}}
<button class='button pvt-msg'><span><i class='icon-chat'></i> {{_ "Conversation"}}</span></button>
{{/if}}
{{else}}
<button class='button red stop-video'><span><i class='icon-videocam'></i> {{_ "Stop_Video"}}</span></button>
{{/unless}}
{{/if}}
{{#if showAll}}
<button class='button secondary back'><span>{{_ "View_All"}} <i class='icon-angle-right'></i></span></button>
{{#if canDirectMessage}}
<button class='button pvt-msg'><span><i class='icon-chat'></i> {{_ "Conversation"}}</span></button>
{{/if}}
{{/if}}
</nav>
</nav>
{{/if}}
</template>
44 changes: 44 additions & 0 deletions server/publications/fullUserData.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Meteor.publish 'fullUserData', (filter, limit) ->
unless @userId
return @ready()

user = Meteor.users.findOne @userId

fields =
name: 1
username: 1
status: 1
utcOffset: 1

if user.admin is true
fields = _.extend fields,
emails: 1
phone: 1
statusConnection: 1
admin: 1
lastLogin: 1
active: 1
services: 1
else
limit = 1

filter = s.trim filter

if not filter and limit is 1
return @ready()

if filter
if limit is 1
query = { username: filter }
else
filterReg = new RegExp filter, "i"
query = { $or: [ { username: filterReg }, { name: filterReg }, { "emails.address": filterReg } ] }
else
query = {}

console.log '[publish] fullUserData'.green, filter, limit

Meteor.users.find query,
fields: fields
limit: limit
sort: { username: 1 }
38 changes: 0 additions & 38 deletions server/publications/fullUsers.coffee

This file was deleted.

0 comments on commit 59c2b01

Please sign in to comment.