Skip to content

Commit

Permalink
Merge branch 'master' of github.com:RocketChat/Rocket.Chat into flow-…
Browse files Browse the repository at this point in the history
…router

# Conflicts:
#	client/views/app/room.coffee
  • Loading branch information
rodrigok committed Jul 16, 2015
2 parents f6a1fee + 76cb97c commit 4d46252
Show file tree
Hide file tree
Showing 19 changed files with 178 additions and 198 deletions.
44 changes: 5 additions & 39 deletions client/lib/chatMessages.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,18 @@
wrapper = {}
input = {}
editing = {}
selfTyping = new ReactiveVar false
typingTimeout = {}


init = ->
wrapper = $(".messages-container").find(".wrapper")
input = $(".input-message").get(0)
# self.scrollable = false
# wrapper.bind "scroll", ->
# scrollable()
bindEvents()
return

# isScrollable = ->
# self.scrollable

resize = ->
dif = 60 + $(".messages-container").find("footer").outerHeight()
$(".messages-box").css
height: "calc(100% - #{dif}px)"

# scrollable = ->
# wrapper = $(".messages-container").find(".wrapper")
# top = wrapper.scrollTop() + wrapper.outerHeight()
# if top == wrapper.get(0).scrollHeight
# self.scrollable = true
# else
# self.scrollable = false

toPrevMessage = ->
msgs = wrapper.get(0).querySelectorAll(".own:not(.system)")
if msgs.length
Expand Down Expand Up @@ -83,9 +67,6 @@
else
editing.saved = input.value

# toBottom = ->
# ScrollListener.toBottom()

send = (rid, input) ->
if _.trim(input.value) isnt ''
KonchatNotification.removeRoomNotification(rid)
Expand All @@ -109,30 +90,18 @@

startTyping = (rid, input) ->
if _.trim(input.value) isnt ''
unless typingTimeout?[rid]
if Meteor.userId()?
selfTyping.set true
Meteor.call 'typingStatus', rid, true
typingTimeout[rid] = Meteor.setTimeout ->
stopTyping(rid)
, 10000
MsgTyping.start(rid)
else
stopTyping(rid)
MsgTyping.stop(rid)

stopTyping = (rid) ->
selfTyping.set false
if typingTimeout?[rid]?
clearTimeout(typingTimeout[rid])
typingTimeout[rid] = null

Meteor.call 'typingStatus', rid, false
MsgTyping.stop(rid)

bindEvents = ->
if wrapper?.length
$(".input-message").autogrow
postGrowCallback: ->
resize()
# toBottom() if self.scrollable

keyup = (rid, event) ->
input = event.currentTarget
Expand Down Expand Up @@ -194,13 +163,10 @@
RoomHistoryManager.clear rid


# isScrollable: isScrollable
# toBottom: toBottom
keydown: keydown
keyup: keyup
deleteMsg: deleteMsg
send: send
init: init
edit: edit
selfTyping: selfTyping
)()
)()
1 change: 0 additions & 1 deletion client/lib/collections.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
@ChatRoom = new Meteor.Collection 'data.ChatRoom'
@ChatSubscription = new Meteor.Collection 'data.ChatSubscription'
@ChatMessage = new Meteor.Collection 'data.ChatMessage'
@ChatTyping = new Meteor.Collection 'data.ChatTyping'

Meteor.startup ->
ChatMessage.find().observe
Expand Down
62 changes: 62 additions & 0 deletions client/lib/msgTyping.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
@MsgTyping = do ->
stream = new Meteor.Stream 'typing'
timeout = 15000
timeouts = {}
renew = true
renewTimeout = 10000
selfTyping = new ReactiveVar false
usersTyping = {}

addStream = (room) ->
unless usersTyping[room]?
usersTyping[room] = { users: new ReactiveVar {} }
stream.on room, (typing) ->
unless typing.username is Meteor.user()?.username
if typing.start
users = usersTyping[room].users.get()
users[typing.username] = Meteor.setTimeout ->
delete users[typing.username]
usersTyping[room].users.set users
, timeout
usersTyping[room].users.set users
else if typing.stop
users = usersTyping[room].users.get()
delete users[typing.username]
usersTyping[room].users.set users

Tracker.autorun ->
addStream Session.get 'openedRoom'

start = (room) ->
return unless renew

setTimeout ->
renew = true
, renewTimeout

renew = false
selfTyping.set true
stream.emit 'typing', { room: room, username: Meteor.user().username, start: true }
clearTimeout timeouts[room]
timeouts[room] = Meteor.setTimeout ->
stop(room)
, timeout

stop = (room) ->
renew = true
selfTyping.set false
if timeouts?[room]?
clearTimeout(timeouts[room])
timeouts[room] = null
stream.emit 'typing', { room: room, username: Meteor.user().username, stop: true }

get = (room) ->
users = usersTyping[room].users.get()
return _.keys(users) or []

return {
start: start
stop: stop
get: get
selfTyping: selfTyping
}
3 changes: 3 additions & 0 deletions client/startup/cordovaStatusBar.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Meteor.startup ->
if Meteor.isCordova
StatusBar.hide()
3 changes: 0 additions & 3 deletions client/startup/startup.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ Meteor.startup ->
UserPresence.start()
Meteor.subscribe("activeUsers")

Tracker.autorun ->
Meteor.subscribe 'typing', Session.get 'openedRoom'

Session.setDefault('flexOpened', false)
Session.setDefault('AvatarRandom', 0)

Expand Down
32 changes: 17 additions & 15 deletions client/stylesheets/base.less
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ blockquote {
}
}

.flex-center{
display: -webkit-flex;
display: flex;
-webkit-align-items: center;
align-items: center;
}

.copyonly {
float: left;
display: inline-block;
Expand Down Expand Up @@ -795,8 +802,7 @@ a.github-fork {
width: 100%;
height: 100%;
color: #FFF;
display: flex;
align-items: center;
.flex-center;
justify-content: center;
font-family: Helvetica;
text-transform: uppercase;
Expand Down Expand Up @@ -865,9 +871,8 @@ a.github-fork {
position: relative;
padding: 0 25px 0 10px;
height: 100%;
display: flex;
.flex-center;
flex-flow: row nowrap;
align-items: center;
.calc(width, ~"100% - 60px");
}
h4 {
Expand Down Expand Up @@ -1282,7 +1287,7 @@ a.github-fork {
display: block;
width: 100%;
height: 100%;
padding-top: 2px;
margin-top: -1px;
&:hover {
text-decoration: none;
}
Expand All @@ -1300,8 +1305,8 @@ a.github-fork {
}
img {
display: inline-block;
max-width: 100%;
margin-bottom: -12px;
max-width: 222px;
margin-bottom: -10px;
}
}
.search-form {
Expand Down Expand Up @@ -1498,9 +1503,8 @@ a.github-fork {

.fixed-title {
position: absolute;
display: flex;
.flex-center;
flex-flow: row nowrap;
align-items: center;
padding: 0 10px 0 20px;
background: #fff;
border-bottom: 1px solid @tertiary-background-color;
Expand Down Expand Up @@ -1623,7 +1627,7 @@ a.github-fork {
.logo {
display: block;
margin: 10px 0;
max-width: 100%;
max-width: 325px;
}
.info {
max-width: 680px;
Expand Down Expand Up @@ -2829,11 +2833,10 @@ a.github-fork {
}

.landing-page {
.flex-center;
flex-flow: row nowrap;
text-align: center;
display: flex;
margin: auto;
flex-flow: row nowrap;
align-items: center;
width: 100%;
min-height: 100%;
z-index: 101;
Expand Down Expand Up @@ -3000,9 +3003,8 @@ a.github-fork {
.avatar-suggestion-item {
margin: 5px 0px;
text-align: left;
display: flex;
.flex-center;
flex-flow: row nowrap;
align-items: center;
width: 100%;
padding: 12px;
background-color: @secondary-background-color;
Expand Down
2 changes: 1 addition & 1 deletion client/views/app/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<i></i>
</div>
<h2>
<span class="room-title">{{_ "Welcome_to_the"}}</span>
<span class="room-title">{{_ "Welcome_to_the"}} Rocket.Chat</span>
</h2>
</header>
<div class="content">
Expand Down
Loading

0 comments on commit 4d46252

Please sign in to comment.