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
c793b846
Commit
c793b846
authored
Mar 08, 2016
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only ask for permission once the user is already logged in
updates #443
parent
02faa555
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
src/converse-core.js
src/converse-core.js
+2
-0
src/converse-notification.js
src/converse-notification.js
+9
-4
No files found.
src/converse-core.js
View file @
c793b846
...
@@ -629,6 +629,7 @@
...
@@ -629,6 +629,7 @@
if
(
converse
.
disconnection_cause
===
Strophe
.
Status
.
CONNFAIL
&&
converse
.
auto_reconnect
)
{
if
(
converse
.
disconnection_cause
===
Strophe
.
Status
.
CONNFAIL
&&
converse
.
auto_reconnect
)
{
converse
.
reconnect
(
condition
);
converse
.
reconnect
(
condition
);
}
else
{
}
else
{
// FIXME: leaky abstraction from converse-controlbox.js
converse
.
renderLoginPanel
();
converse
.
renderLoginPanel
();
}
}
}
else
if
(
status
===
Strophe
.
Status
.
ERROR
)
{
}
else
if
(
status
===
Strophe
.
Status
.
ERROR
)
{
...
@@ -646,6 +647,7 @@
...
@@ -646,6 +647,7 @@
}
else
if
(
status
===
Strophe
.
Status
.
DISCONNECTING
)
{
}
else
if
(
status
===
Strophe
.
Status
.
DISCONNECTING
)
{
// FIXME: what about prebind?
// FIXME: what about prebind?
if
(
!
converse
.
connection
.
connected
)
{
if
(
!
converse
.
connection
.
connected
)
{
// FIXME: leaky abstraction from converse-controlbox.js
converse
.
renderLoginPanel
();
converse
.
renderLoginPanel
();
}
}
if
(
condition
)
{
if
(
condition
)
{
...
...
src/converse-notification.js
View file @
c793b846
...
@@ -20,10 +20,6 @@
...
@@ -20,10 +20,6 @@
var
supports_html5_notification
=
"
Notification
"
in
window
;
var
supports_html5_notification
=
"
Notification
"
in
window
;
if
(
supports_html5_notification
&&
Notification
.
permission
!==
'
denied
'
)
{
// Ask user to enable HTML5 notifications
Notification
.
requestPermission
();
}
converse_api
.
plugins
.
add
(
'
notification
'
,
{
converse_api
.
plugins
.
add
(
'
notification
'
,
{
...
@@ -195,9 +191,18 @@
...
@@ -195,9 +191,18 @@
}
}
};
};
converse
.
requestPermission
=
function
(
evt
)
{
if
(
supports_html5_notification
&&
!
_
.
contains
([
'
denied
'
,
'
granted
'
],
Notification
.
permission
))
{
// Ask user to enable HTML5 notifications
Notification
.
requestPermission
();
}
};
converse
.
on
(
'
contactRequest
'
,
converse
.
handleContactRequestNotification
);
converse
.
on
(
'
contactRequest
'
,
converse
.
handleContactRequestNotification
);
converse
.
on
(
'
contactStatusChanged
'
,
converse
.
handleChatStateNotification
);
converse
.
on
(
'
contactStatusChanged
'
,
converse
.
handleChatStateNotification
);
converse
.
on
(
'
message
'
,
converse
.
handleMessageNotification
);
converse
.
on
(
'
message
'
,
converse
.
handleMessageNotification
);
converse
.
on
(
'
ready
'
,
converse
.
requestPermission
);
}
}
});
});
}));
}));
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