From 570db98548282d0d41ea573f9666fa9d7755e8ba Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Fri, 14 Nov 2014 17:01:09 +0000 Subject: [PATCH] Unbreak tab complete... --- syweb/webclient/room/room-directive.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/syweb/webclient/room/room-directive.js b/syweb/webclient/room/room-directive.js index 187032aa88..4707d12c8c 100644 --- a/syweb/webclient/room/room-directive.js +++ b/syweb/webclient/room/room-directive.js @@ -17,6 +17,7 @@ 'use strict'; angular.module('RoomController') +// XXX FIXME : This has tight coupling with $scope.room.now.members .directive('tabComplete', ['$timeout', function ($timeout) { return function (scope, element, attrs) { element.bind("keydown keypress", function (event) { @@ -80,16 +81,16 @@ angular.module('RoomController') var expansion; // FIXME: could do better than linear search here - angular.forEach(scope.members, function(item, name) { - if (item.displayname && searchIndex < targetIndex) { - if (item.displayname.toLowerCase().indexOf(search[1].toLowerCase()) === 0) { - expansion = item.displayname; + angular.forEach(scope.room.now.members, function(item, name) { + if (item.event.content.displayname && searchIndex < targetIndex) { + if (item.event.content.displayname.toLowerCase().indexOf(search[1].toLowerCase()) === 0) { + expansion = item.event.content.displayname; searchIndex++; } } }); if (searchIndex < targetIndex) { // then search raw mxids - angular.forEach(scope.members, function(item, name) { + angular.forEach(scope.room.now.members, function(item, name) { if (searchIndex < targetIndex) { // === 1 because mxids are @username if (name.toLowerCase().indexOf(search[1].toLowerCase()) === 1) {