Ver código fonte

Only show desktop notifications for error/warn feedback messages

JC Brand 9 anos atrás
pai
commit
ba67f37473
1 arquivos alterados com 8 adições e 6 exclusões
  1. 8 6
      src/converse-notification.js

+ 8 - 6
src/converse-notification.js

@@ -195,12 +195,14 @@
             };
 
             converse.showFeedbackNotification = function (data) {
-                var n = new Notification(data.subject, {
-                        body: data.message,
-                        lang: converse.i18n.locale_data.converse[""].lang,
-                        icon: 'logo/conversejs.png'
-                    });
-                setTimeout(n.close.bind(n), 5000);
+                if (data.klass === 'error' || data.klass === 'warn') {
+                    var n = new Notification(data.subject, {
+                            body: data.message,
+                            lang: converse.i18n.locale_data.converse[""].lang,
+                            icon: 'logo/conversejs.png'
+                        });
+                    setTimeout(n.close.bind(n), 5000);
+                }
             };
 
             converse.handleChatStateNotification = function (evt, contact) {