Finish up room controller too. May have missed one or two, but testing didn't pick anything up.

This commit is contained in:
Kegan Dougal 2014-08-14 15:47:38 +01:00
parent 24bd133d9d
commit 40c998336d

View File

@ -99,8 +99,8 @@ angular.module('RoomController', [])
function(response) { function(response) {
var member = $scope.members[chunk.target_user_id]; var member = $scope.members[chunk.target_user_id];
if (member !== undefined) { if (member !== undefined) {
console.log("Updated displayname "+chunk.target_user_id+" to " + response.displayname); console.log("Updated displayname "+chunk.target_user_id+" to " + response.data.displayname);
member.displayname = response.displayname; member.displayname = response.data.displayname;
} }
} }
); );
@ -108,8 +108,8 @@ angular.module('RoomController', [])
function(response) { function(response) {
var member = $scope.members[chunk.target_user_id]; var member = $scope.members[chunk.target_user_id];
if (member !== undefined) { if (member !== undefined) {
console.log("Updated image for "+chunk.target_user_id+" to " + response.avatar_url); console.log("Updated image for "+chunk.target_user_id+" to " + response.data.avatar_url);
member.avatar_url = response.avatar_url; member.avatar_url = response.data.avatar_url;
} }
} }
); );
@ -171,8 +171,8 @@ angular.module('RoomController', [])
console.log("Sent message"); console.log("Sent message");
$scope.textInput = ""; $scope.textInput = "";
}, },
function(reason) { function(error) {
$scope.feedback = "Failed to send: " + reason; $scope.feedback = "Failed to send: " + error.data.error;
}); });
}; };
@ -190,13 +190,13 @@ angular.module('RoomController', [])
// Get the current member list // Get the current member list
matrixService.getMemberList($scope.room_id).then( matrixService.getMemberList($scope.room_id).then(
function(response) { function(response) {
for (var i = 0; i < response.chunk.length; i++) { for (var i = 0; i < response.data.chunk.length; i++) {
var chunk = response.chunk[i]; var chunk = response.data.chunk[i];
updateMemberList(chunk); updateMemberList(chunk);
} }
}, },
function(reason) { function(error) {
$scope.feedback = "Failed get member list: " + reason; $scope.feedback = "Failed get member list: " + error.data.error;
} }
); );
}, },
@ -224,8 +224,8 @@ angular.module('RoomController', [])
console.log("Left room "); console.log("Left room ");
$location.path("rooms"); $location.path("rooms");
}, },
function(reason) { function(error) {
$scope.feedback = "Failed to leave room: " + reason; $scope.feedback = "Failed to leave room: " + error.data.error;
}); });
}; };
@ -234,8 +234,8 @@ angular.module('RoomController', [])
function() { function() {
console.log("Image sent"); console.log("Image sent");
}, },
function(reason) { function(error) {
$scope.feedback = "Failed to send image: " + reason; $scope.feedback = "Failed to send image: " + error.data.error;
}); });
}; };