Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #450 from crdlc/bug-1121416
Browse files Browse the repository at this point in the history
Bug 1121416 - [Loop] Invitee name is not shown in history details when h...
  • Loading branch information
Cristian Rodriguez committed Jan 15, 2015
2 parents a4e82be + 10d4bd8 commit d2b3f74
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 33 deletions.
7 changes: 4 additions & 3 deletions app/js/helpers/room/room_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@
_startCommunicationTime = new Date().getTime();
_communicationEnd = false;
_communicationToken = currentToken;
Rooms.get(currentToken).then(room => _participants = room.participants);
}

function _logEventCommunication(aCurrentTime) {
Expand All @@ -180,9 +181,9 @@
i++) {
// If participants[i] is not logged he hasn't account and we want
// to keep RoomEvent identifier
if (_participants[i].account &&
_participants[i].account !== Controller.identity) {
other = _participants[i].account;
var account = _participants[i].account;
if (account && (account !== Controller.identity)) {
other = account;
}
}
RoomEvent.save({type: RoomEvent.type.communication,
Expand Down
39 changes: 9 additions & 30 deletions app/js/screens/room/room_history.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@

function _renderEvt(aEvtItem) {
if (!aEvtItem) {
return;
return Promise.reject();
}
var group = _getGroup(aEvtItem.date);
_createEventDOM(aEvtItem).then(element => {;
return _createEventDOM(aEvtItem).then(element => {
_renderedIndex++;
if (_renderedIndex > CHUNK_SIZE) {
element.classList.add('hidden');
Expand All @@ -127,33 +127,6 @@
});
}

function _getAll(aToken) {
var _elements = [];
return new Promise((resolve, reject) => {
RoomsDB.getEvents(aToken).then((cursor) => {
if (!cursor) {
return resolve();
}

cursor.onsuccess = function onsuccess(evt) {
var item = evt.target.result;
if (!item) {
return resolve();
}
_elements.push(item.value);
item.continue();
};

cursor.onerror = function onerror(evt) {
console.error('Error iterating events cursor', error);
return resolve();
};
}, (error) => {
console.error('Error getEvents', error);
});
});
}

function _renderInfo(aRoom) {
if (!aRoom || !aRoom.roomToken) {
return;
Expand All @@ -168,7 +141,13 @@
// We want desc sorting
return b.date.getTime() - a.date.getTime();
});
_elements.forEach(_renderEvt);
// The scroll based on chunks requires items have to be rendered
// once the previous one was done because of "_renderedIndex". Some
// items here take more time than others because of mozContacts so we
// have to wait for them.
var renderNextEvent = idx =>
_renderEvt(_elements[idx]).then(renderNextEvent.bind(null, ++idx));
renderNextEvent(0);
}
});
};
Expand Down

0 comments on commit d2b3f74

Please sign in to comment.