[Git][noosfero/noosfero][stable-1.8] Merge branch 'fix-notifications-crash' into 'master'
Rodrigo Souto
gitlab at mg.gitlab.com
Fri Jun 2 09:39:58 BRT 2017
Rodrigo Souto pushed to branch stable-1.8 at Noosfero / noosfero
Commits:
fa8fa5c9 by Rodrigo Souto at 2017-06-02T12:39:48+00:00
Merge branch 'fix-notifications-crash' into 'master'
Fix notifications javascript crash when blocked
See merge request !1223
- - - - -
1 changed file:
- public/javascripts/application.js
Changes:
=====================================
public/javascripts/application.js
=====================================
--- a/public/javascripts/application.js
+++ b/public/javascripts/application.js
@@ -1147,10 +1147,8 @@ function notifyMe(title, options) {
notification = new Notification(title, options);
}
- // Otherwise, we need to ask the user for permission
- // Note, Chrome does not implement the permission static property
- // So we have to check for NOT 'denied' instead of 'default'
- else if (Notification.permission !== 'denied') {
+ // Otherwise, we need to ask the user for permission.
+ else if (Notification.permission === 'default') {
Notification.requestPermission(function (permission) {
// Whatever the user answers, we make sure we store the information
if (!('permission' in Notification)) {
@@ -1164,12 +1162,14 @@ function notifyMe(title, options) {
});
}
- notification.onclick = function(){
- notification.close();
- // Chromium tweak
- window.open().close();
- window.focus();
- };
+ if(notification) {
+ notification.onclick = function(){
+ notification.close();
+ // Chromium tweak
+ window.open().close();
+ window.focus();
+ };
+ }
return notification;
// At last, if the user already denied any notification, and you
View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/fa8fa5c9a227ac013164a8eab5d5e4fc86a64da9
---
View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/fa8fa5c9a227ac013164a8eab5d5e4fc86a64da9
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20170602/ade335b0/attachment-0001.html>
More information about the Noosfero-dev
mailing list