From 1a5b36b6f7ce2a0c1e7d044f8c71bb09c7a0680a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20H=C3=BCbschle-Schneider?= Date: Mon, 17 Feb 2014 12:31:23 +0000 Subject: [PATCH 1/2] switchToActivityBuffer: Prioritise notifications If there is a buffer with a notification, go there. Otherwise, go to one with unread lines. --- js/glowingbear.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/glowingbear.js b/js/glowingbear.js index 3a2ab93..7b00eb6 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -738,7 +738,11 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', if (buffer.notification > 0) { $scope.setActiveBuffer(buffer.id); break; - } else if(buffer.unread > 0) { + } + } + for (var i in sortedBuffers) { + var buffer = sortedBuffers[i]; + if(buffer.unread > 0) { $scope.setActiveBuffer(buffer.id); break; } From c1760e54335d13fa85fff373ae36009bbe5c5af5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20H=C3=BCbschle-Schneider?= Date: Mon, 17 Feb 2014 12:37:14 +0000 Subject: [PATCH 2/2] Fix JS coding style TODO: rebase this as a fixup. I don't think the github web interface supports that. --- js/glowingbear.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/js/glowingbear.js b/js/glowingbear.js index 7b00eb6..22fe4d8 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -733,15 +733,16 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', $rootScope.switchToActivityBuffer = function() { // Find next buffer with activity and switch to it var sortedBuffers = _.sortBy($scope.buffers, 'number'); - for (var i in sortedBuffers) { - var buffer = sortedBuffers[i]; + var i, buffer; + for (i in sortedBuffers) { + buffer = sortedBuffers[i]; if (buffer.notification > 0) { $scope.setActiveBuffer(buffer.id); break; } } - for (var i in sortedBuffers) { - var buffer = sortedBuffers[i]; + for (i in sortedBuffers) { + buffer = sortedBuffers[i]; if(buffer.unread > 0) { $scope.setActiveBuffer(buffer.id); break;