Remove duplicate source of truth with buffers.

This commit is contained in:
Kramer Campbell 2014-07-01 15:07:34 -07:00
parent 118b401d76
commit b21662da3c
2 changed files with 4 additions and 6 deletions

View file

@ -215,7 +215,7 @@ $ openssl req -nodes -newkey rsa:4096 -keyout relay.pem -x509 -days 365 -out rel
<input class="form-control monospace" type="text" id="bufferFilter" ng-model="search" ng-keydown="handleSearchBoxKey($event)" placeholder="Search"> <input class="form-control monospace" type="text" id="bufferFilter" ng-model="search" ng-keydown="handleSearchBoxKey($event)" placeholder="Search">
</form> </form>
</li> </li>
<li class="buffer" ng-class="{'active': buffer.active, 'indent': buffer.indent }" ng-repeat="(key, buffer) in (filteredBuffers = (buffers | toArray | filter:{fullName:search} | filter:hasUnread | orderBy:predicate))"> <li class="buffer" ng-class="{'active': buffer.active, 'indent': buffer.indent }" ng-repeat="(key, buffer) in (filteredBuffers = (getBuffers() | toArray | filter:{fullName:search} | filter:hasUnread | orderBy:predicate))">
<a href="#" ng-click="setActiveBuffer(buffer.id)" title="{{ buffer.fullName }}"> <a href="#" ng-click="setActiveBuffer(buffer.id)" title="{{ buffer.fullName }}">
<span class="badge pull-right" ng-class="{'danger': buffer.notification}" ng-if="buffer.notification || buffer.unread" ng-bind="buffer.notification || buffer.unread"></span> <span class="badge pull-right" ng-class="{'danger': buffer.notification}" ng-if="buffer.notification || buffer.unread" ng-bind="buffer.notification || buffer.unread"></span>
<span class="buffername">{{ buffer.shortName || buffer.fullName }}</span> <span class="buffername">{{ buffer.shortName || buffer.fullName }}</span>

View file

@ -774,9 +774,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
}); });
$rootScope.$on('relayDisconnect', function() { $rootScope.$on('relayDisconnect', function() {
// this reinitialze just breaks the bufferlist upon reconnection. models.reinitialize();
// Disabled it until it's fully investigated and fixed
//models.reinitialize();
$rootScope.$emit('notificationChanged'); $rootScope.$emit('notificationChanged');
$scope.connectbutton = 'Connect'; $scope.connectbutton = 'Connect';
}); });
@ -784,7 +782,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
$scope.showSidebar = true; $scope.showSidebar = true;
$scope.buffers = models.model.buffers; $scope.getBuffers = models.getBuffers.bind(models);
$scope.bufferlines = {}; $scope.bufferlines = {};
$scope.nicklist = {}; $scope.nicklist = {};
@ -1125,7 +1123,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
$rootScope.switchToActivityBuffer = function() { $rootScope.switchToActivityBuffer = function() {
// Find next buffer with activity and switch to it // Find next buffer with activity and switch to it
var sortedBuffers = _.sortBy($scope.buffers, 'number'); var sortedBuffers = _.sortBy($scope.getBuffers(), 'number');
var i, buffer; var i, buffer;
// Try to find buffer with notification // Try to find buffer with notification
for (i in sortedBuffers) { for (i in sortedBuffers) {