1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-28 05:03:59 +03:00

lint and thinkos

This commit is contained in:
Matthew Hodgson
2016-01-08 03:41:05 +00:00
parent 387ad09c5f
commit c64aebdb17
2 changed files with 17 additions and 9 deletions

View File

@@ -138,7 +138,8 @@ SyncApi.prototype.syncLeftRooms = function() {
return;
}
leaveObj.timeline = leaveObj.timeline || {};
var timelineEvents = self._mapSyncEventsFormat(leaveObj.timeline, room, 'timeline');
var timelineEvents =
self._mapSyncEventsFormat(leaveObj.timeline, room, 'timeline');
var stateEvents = self._mapSyncEventsFormat(leaveObj.state, room, 'state');
var paginationToken = (
leaveObj.timeline.limited ? leaveObj.timeline.prev_batch : null
@@ -324,7 +325,8 @@ SyncApi.prototype._sync = function(syncOptions, attempt) {
// Handle invites
inviteRooms.forEach(function(inviteObj) {
var room = inviteObj.room;
var stateEvents = self._mapSyncEventsFormat(inviteObj.invite_state, room, 'state');
var stateEvents =
self._mapSyncEventsFormat(inviteObj.invite_state, room, 'state');
self._processRoomEvents(room, stateEvents);
if (inviteObj.isBrandNewRoom) {
room.recalculate(client.credentials.userId);
@@ -338,9 +340,12 @@ SyncApi.prototype._sync = function(syncOptions, attempt) {
joinRooms.forEach(function(joinObj) {
var room = joinObj.room;
var stateEvents = self._mapSyncEventsFormat(joinObj.state, room, 'state');
var timelineEvents = self._mapSyncEventsFormat(joinObj.timeline, room, 'timeline');
var ephemeralEvents = self._mapSyncEventsFormat(joinObj.ephemeral, undefined, 'ephemeral');
var accountDataEvents = self._mapSyncEventsFormat(joinObj.account_data, undefined, 'account_data');
var timelineEvents =
self._mapSyncEventsFormat(joinObj.timeline, room, 'timeline');
var ephemeralEvents =
self._mapSyncEventsFormat(joinObj.ephemeral, undefined, 'ephemeral');
var accountDataEvents =
self._mapSyncEventsFormat(joinObj.account_data, undefined, 'account_data');
// we do this first so it's correct when any of the events fire
room.unread_notification_count = joinObj.unread_notification_count;
@@ -379,7 +384,8 @@ SyncApi.prototype._sync = function(syncOptions, attempt) {
leaveRooms.forEach(function(leaveObj) {
// Do the bear minimum to register rejected invites / you leaving rooms
var room = leaveObj.room;
var timelineEvents = self._mapSyncEventsFormat(leaveObj.timeline, room, 'timeline');
var timelineEvents =
self._mapSyncEventsFormat(leaveObj.timeline, room, 'timeline');
room.addEvents(timelineEvents);
timelineEvents.forEach(function(e) { client.emit("event", e); });
});
@@ -457,7 +463,8 @@ SyncApi.prototype._mapSyncResponseToRoomArray = function(obj) {
/**
* @param {Object} obj
* @param {Room} room
* @param {String} /sync section (timeline, state, ephemeral, account_data)
* @param {String} section /sync section
* (timeline, state, ephemeral, account_data)
* @return {MatrixEvent[]}
*/
SyncApi.prototype._mapSyncEventsFormat = function(obj, room, section) {