Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
f947bcc4
Commit
f947bcc4
authored
Aug 29, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Also notify if the chat is not visible in the page.
parent
33c2d461
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
src/converse-notification.js
src/converse-notification.js
+11
-9
No files found.
src/converse-notification.js
View file @
f947bcc4
// Converse.js (A browser based XMPP chat client)
// http://conversejs.org
//
// Copyright (c) 201
2-2017, Jan-Carel
Brand <jc@opkode.com>
// Copyright (c) 201
3-2018, JC
Brand <jc@opkode.com>
// Licensed under the Mozilla Public License (MPLv2)
//
/*global define */
...
...
@@ -10,10 +10,13 @@
define
([
"
converse-core
"
],
factory
);
}(
this
,
function
(
converse
)
{
"
use strict
"
;
const
{
utils
,
Strophe
,
_
}
=
converse
.
env
;
const
{
Strophe
,
_
}
=
converse
.
env
,
u
=
converse
.
env
.
utils
;
converse
.
plugins
.
add
(
'
converse-notification
'
,
{
dependencies
:
[
"
converse-chatboxes
"
],
initialize
()
{
/* The initialize function gets called as soon as the plugin is
* loaded by converse.js's plugin machinery.
...
...
@@ -72,10 +75,11 @@
_converse
.
isMessageToHiddenChat
=
function
(
message
)
{
if
(
_
.
includes
([
'
mobile
'
,
'
fullscreen
'
,
'
embedded
'
],
_converse
.
view_mode
))
{
const
jid
=
Strophe
.
getBareJidFromJid
(
message
.
getAttribute
(
'
from
'
));
const
model
=
_converse
.
chatboxes
.
get
(
jid
);
if
(
!
_
.
isNil
(
model
))
{
return
model
.
get
(
'
hidden
'
)
||
_converse
.
windowState
===
'
hidden
'
;
const
jid
=
Strophe
.
getBareJidFromJid
(
message
.
getAttribute
(
'
from
'
)),
view
=
_converse
.
chatboxviews
.
get
(
jid
);
if
(
!
_
.
isNil
(
view
))
{
return
view
.
model
.
get
(
'
hidden
'
)
||
_converse
.
windowState
===
'
hidden
'
||
!
u
.
isVisible
(
view
.
el
);
}
return
true
;
}
...
...
@@ -83,14 +87,12 @@
}
_converse
.
shouldNotifyOfMessage
=
function
(
message
)
{
/* Is this a message worthy of notification?
*/
const
forwarded
=
message
.
querySelector
(
'
forwarded
'
);
if
(
!
_
.
isNull
(
forwarded
))
{
return
false
;
}
else
if
(
message
.
getAttribute
(
'
type
'
)
===
'
groupchat
'
)
{
return
_converse
.
shouldNotifyOfGroupMessage
(
message
);
}
else
if
(
u
tils
.
isHeadlineMessage
(
_converse
,
message
))
{
}
else
if
(
u
.
isHeadlineMessage
(
_converse
,
message
))
{
// We want to show notifications for headline messages.
return
_converse
.
isMessageToHiddenChat
(
message
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment