[Git][noosfero/noosfero][master] 2 commits: Fix js notification crash when notifications are blocked.
Rodrigo Souto
gitlab at mg.gitlab.com
Fri Jun 2 09:36:14 BRT 2017
Rodrigo Souto pushed to branch master at Noosfero / noosfero
Commits:
d0593f61 by pedrodelyra at 2017-06-01T18:10:12-03:00
Fix js notification crash when notifications are blocked.
- - - - -
4b251dce by Rodrigo Souto at 2017-06-02T12:35:44+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/compare/500594d50759beca96ba9ece960e24ba9a18033e...4b251dceb01cc53a2c8a98a18c6881323e4eb20f
---
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/500594d50759beca96ba9ece960e24ba9a18033e...4b251dceb01cc53a2c8a98a18c6881323e4eb20f
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/50dadecf/attachment-0001.html>
More information about the Noosfero-dev
mailing list