Merge pull request #234 from lorenzhs/notificationcount

Add notification count to notifications
This commit is contained in:
David Cormier 2014-03-19 13:13:04 -04:00
commit f20f7f950e

View file

@ -935,11 +935,21 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
$rootScope.createHighlight = function(buffer, message) { $rootScope.createHighlight = function(buffer, message) {
var title = ''; var title = '';
var body = ''; var body = '';
var numNotifications = buffer.notification;
if (['#', '&', '+', '!'].indexOf(buffer.shortName.charAt(0)) < 0) { if (['#', '&', '+', '!'].indexOf(buffer.shortName.charAt(0)) < 0) {
title = 'Private message from '; if (numNotifications > 1) {
title = numNotifications.toString() + ' private messages from ';
} else {
title = 'Private message from ';
}
body = message.text; body = message.text;
} else { } else {
title = 'Highlight in '; if (numNotifications > 1) {
title = numNotifications.toString() + ' highlights in ';
} else {
title = 'Highlight in ';
}
var prefix = ''; var prefix = '';
for (var i = 0; i < message.prefix.length; i++) { for (var i = 0; i < message.prefix.length; i++) {
prefix += message.prefix[i].text; prefix += message.prefix[i].text;