manu: what's going on here?

This commit is contained in:
Matthew Hodgson 2014-09-23 20:00:56 +01:00
parent a7d53227de
commit cbea225d97

View File

@ -101,7 +101,7 @@ function(matrixService, $rootScope, $q, $timeout, mPresence) {
var initRoom = function(room_id, room) {
if (!(room_id in $rootScope.events.rooms)) {
console.log("Creating new handler entry for " + room_id);
console.log("Creating new rooms entry for " + room_id);
$rootScope.events.rooms[room_id] = {
room_id: room_id,
messages: [],
@ -113,10 +113,11 @@ function(matrixService, $rootScope, $q, $timeout, mPresence) {
};
}
if (room) {
if (room) { // we got an existing room object from initialsync, seemingly.
// Report all other metadata of the room object (membership, inviter, visibility, ...)
// XXX: do we *REALLY* want to iterate over *EVERY* field in the object, including all its methods etc? -- Matthew
for (var field in room) {
if (-1 === ["room_id", "messages", "state"].indexOf(field)) {
if (-1 === ["room_id", "messages", "state"].indexOf(field)) { // why indexOf - why not ===? --Matthew
$rootScope.events.rooms[room_id][field] = room[field];
}
}