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

@@ -729,7 +729,7 @@ MatrixClient.prototype.deleteRoomTag = function(roomId, tagName, callback) {
* @return {module:client.Promise} Resolves: TODO * @return {module:client.Promise} Resolves: TODO
* @return {module:http-api.MatrixError} Rejects: with an error response. * @return {module:http-api.MatrixError} Rejects: with an error response.
*/ */
MatrixClient.prototype.setAccountData = function(event, eventType, content) { MatrixClient.prototype.setAccountData = function(eventType, content, callback) {
var path = utils.encodeUri("/user/$userId/account_data/$type", { var path = utils.encodeUri("/user/$userId/account_data/$type", {
$userId: this.credentials.userId, $userId: this.credentials.userId,
$type: event.getType(), $type: event.getType(),
@@ -747,7 +747,8 @@ MatrixClient.prototype.setAccountData = function(event, eventType, content) {
* @return {module:client.Promise} Resolves: TODO * @return {module:client.Promise} Resolves: TODO
* @return {module:http-api.MatrixError} Rejects: with an error response. * @return {module:http-api.MatrixError} Rejects: with an error response.
*/ */
MatrixClient.prototype.setRoomAccountData = function(roomId, eventType, content, callback) { MatrixClient.prototype.setRoomAccountData = function(roomId, eventType,
content, callback) {
var path = utils.encodeUri("/user/$userId/rooms/$roomId/account_data/$type", { var path = utils.encodeUri("/user/$userId/rooms/$roomId/account_data/$type", {
$userId: this.credentials.userId, $userId: this.credentials.userId,
$roomId: roomId, $roomId: roomId,

View File

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