Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Rocket.Chat
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RocketChat
Rocket.Chat
Commits
e8413a5c
Commit
e8413a5c
authored
9 years ago
by
Rodrigo Nascimento
Browse files
Options
Downloads
Patches
Plain Diff
Keep notifications if window don't has focus
parent
df9e1f59
Loading
Loading
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
client/lib/readMessagesOnFocus.coffee
+8
-0
8 additions, 0 deletions
client/lib/readMessagesOnFocus.coffee
client/startup/unread.coffee
+11
-4
11 additions, 4 deletions
client/startup/unread.coffee
client/views/app/sideNav/chatRoomItem.coffee
+4
-4
4 additions, 4 deletions
client/views/app/sideNav/chatRoomItem.coffee
with
23 additions
and
8 deletions
client/lib/readMessagesOnFocus.coffee
0 → 100644
+
8
−
0
View file @
e8413a5c
Meteor
.
startup
->
$
(
window
).
on
'focus'
,
->
if
FlowRouter
.
getRouteName
()
is
'room'
rid
=
FlowRouter
.
getParam
'_id'
if
rid
?
subscription
=
ChatSubscription
.
findOne
rid
:
rid
if
subscription
?
and
(
subscription
.
alert
is
true
or
subscription
.
unread
>
0
)
Meteor
.
call
'readMessages'
,
rid
\ No newline at end of file
This diff is collapsed.
Click to expand it.
client/startup/unread.coffee
+
11
−
4
View file @
e8413a5c
...
...
@@ -12,12 +12,19 @@ Meteor.startup ->
unreadCount
=
0
unreadAlert
=
false
subscriptions
=
ChatSubscription
.
find
({},
{
fields
:
{
unread
:
1
,
alert
:
1
}
})
subscriptions
=
ChatSubscription
.
find
({},
{
fields
:
{
unread
:
1
,
alert
:
1
,
rid
:
1
}
})
rid
=
undefined
if
FlowRouter
.
getRouteName
()
is
'room'
rid
=
FlowRouter
.
getParam
'_id'
for
subscription
in
subscriptions
.
fetch
()
unreadCount
+=
subscription
.
unread
if
subscription
.
alert
is
true
unreadAlert
=
'•'
if
subscription
.
rid
is
rid
and
(
subscription
.
alert
or
subscription
.
unread
>
0
)
and
document
.
hasFocus
()
Meteor
.
call
'readMessages'
,
subscription
.
rid
else
unreadCount
+=
subscription
.
unread
if
subscription
.
alert
is
true
unreadAlert
=
'•'
if
unreadCount
>
0
if
unreadCount
>
999
...
...
This diff is collapsed.
Click to expand it.
client/views/app/sideNav/chatRoomItem.coffee
+
4
−
4
View file @
e8413a5c
Template
.
chatRoomItem
.
helpers
alert
:
->
return
this
.
alert
if
(
not
FlowRouter
.
getParam
(
'_id'
))
or
FlowRouter
.
getParam
(
'_id'
)
isnt
this
.
rid
if
FlowRouter
.
getParam
(
'_id'
)
isnt
this
.
rid
or
not
document
.
hasFocus
()
return
this
.
alert
unread
:
->
return
this
.
unread
if
(
not
FlowRouter
.
getParam
(
'_id'
))
or
FlowRouter
.
getParam
(
'_id'
)
isnt
this
.
rid
if
(
FlowRouter
.
getParam
(
'_id'
)
isnt
this
.
rid
or
not
document
.
hasFocus
())
and
this
.
unread
>
0
return
this
.
unread
isDirectRoom
:
->
return
this
.
t
is
'd'
...
...
@@ -24,8 +26,6 @@ Template.chatRoomItem.helpers
active
:
->
if
FlowRouter
.
getParam
(
'_id'
)
?
and
FlowRouter
.
getParam
(
'_id'
)
is
this
.
rid
if
this
.
alert
or
this
.
unread
>
0
Meteor
.
call
'readMessages'
,
this
.
rid
return
'active'
canLeave
:
->
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment