Sort buffers by number before switching to buffer with activity. This

better resembles how weechat works
This commit is contained in:
Tor Hveem 2014-02-05 10:42:47 +01:00 committed by David Cormier
parent ef62ddb267
commit e4bbb64b4a
1 changed files with 3 additions and 2 deletions

View File

@ -713,8 +713,9 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
$rootScope.switchToActivityBuffer = function() {
// Find next buffer with activity and switch to it
for(var i in $scope.buffers) {
var buffer = $scope.buffers[i];
var sortedBuffers = _.sortBy($scope.buffers, 'number');
for(var i in sortedBuffers) {
var buffer = sortedBuffers[i];
if(buffer.notification > 0) {
$scope.setActiveBuffer(buffer.id);
break;