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

eslint --fix for dangley commas on function calls

This commit is contained in:
David Baker
2017-01-20 16:12:02 +00:00
parent 007848c42e
commit 423175f539
42 changed files with 389 additions and 389 deletions

View File

@@ -157,7 +157,7 @@ function MatrixClient(opts) {
this._crypto = new Crypto(
this, this,
opts.sessionStore,
userId, this.deviceId
userId, this.deviceId,
);
this.olmVersion = Crypto.getOlmVersion();
@@ -579,7 +579,7 @@ MatrixClient.prototype.setAccountData = function(eventType, contents, callback)
$type: eventType,
});
return this._http.authedRequest(
callback, "PUT", path, undefined, contents
callback, "PUT", path, undefined, contents,
);
};
@@ -629,7 +629,7 @@ MatrixClient.prototype.joinRoom = function(roomIdOrAlias, opts, callback) {
if (opts.inviteSignUrl) {
sign_promise = this._http.requestOtherUrl(
undefined, 'POST',
opts.inviteSignUrl, { mxid: this.credentials.userId }
opts.inviteSignUrl, { mxid: this.credentials.userId },
);
}
@@ -732,7 +732,7 @@ MatrixClient.prototype.getRoomTags = function(roomId, callback) {
$roomId: roomId,
});
return this._http.authedRequest(
callback, "GET", path, undefined
callback, "GET", path, undefined,
);
};
@@ -751,7 +751,7 @@ MatrixClient.prototype.setRoomTag = function(roomId, tagName, metadata, callback
$tag: tagName,
});
return this._http.authedRequest(
callback, "PUT", path, undefined, metadata
callback, "PUT", path, undefined, metadata,
);
};
@@ -769,7 +769,7 @@ MatrixClient.prototype.deleteRoomTag = function(roomId, tagName, callback) {
$tag: tagName,
});
return this._http.authedRequest(
callback, "DELETE", path, undefined, undefined
callback, "DELETE", path, undefined, undefined,
);
};
@@ -789,7 +789,7 @@ MatrixClient.prototype.setRoomAccountData = function(roomId, eventType,
$type: eventType,
});
return this._http.authedRequest(
callback, "PUT", path, undefined, content
callback, "PUT", path, undefined, content,
);
};
@@ -818,7 +818,7 @@ MatrixClient.prototype.setPowerLevel = function(roomId, userId, powerLevel,
$roomId: roomId,
});
return this._http.authedRequest(
callback, "PUT", path, undefined, content
callback, "PUT", path, undefined, content,
);
};
@@ -958,12 +958,12 @@ function _sendEventHttpRequest(client, event) {
path = utils.encodeUri(pathTemplate, pathParams);
} else {
path = utils.encodeUri(
"/rooms/$roomId/send/$eventType/$txnId", pathParams
"/rooms/$roomId/send/$eventType/$txnId", pathParams,
);
}
return client._http.authedRequest(
undefined, "PUT", path, undefined, event.getWireContent()
undefined, "PUT", path, undefined, event.getWireContent(),
);
}
@@ -980,7 +980,7 @@ MatrixClient.prototype.sendMessage = function(roomId, content, txnId, callback)
callback = txnId; txnId = undefined;
}
return this.sendEvent(
roomId, "m.room.message", content, txnId, callback
roomId, "m.room.message", content, txnId, callback,
);
};
@@ -1130,7 +1130,7 @@ MatrixClient.prototype.sendReceipt = function(event, receiptType, callback) {
$eventId: event.getId(),
});
const promise = this._http.authedRequest(
callback, "POST", path, undefined, {}
callback, "POST", path, undefined, {},
);
const room = this.getRoom(event.getRoomId());
@@ -1179,7 +1179,7 @@ MatrixClient.prototype.getUrlPreview = function(url, ts, callback) {
callback, "GET", "/preview_url", {
url: url,
ts: ts,
}, undefined, httpApi.PREFIX_MEDIA_R0
}, undefined, httpApi.PREFIX_MEDIA_R0,
).then(function(response) {
// TODO: expire cache occasionally
self.urlPreviewCache[key] = response;
@@ -1211,7 +1211,7 @@ MatrixClient.prototype.sendTyping = function(roomId, isTyping, timeoutMs, callba
data.timeout = timeoutMs ? timeoutMs : 20000;
}
return this._http.authedRequest(
callback, "PUT", path, undefined, data
callback, "PUT", path, undefined, data,
);
};
@@ -1237,7 +1237,7 @@ MatrixClient.prototype.invite = function(roomId, userId, callback) {
*/
MatrixClient.prototype.inviteByEmail = function(roomId, email, callback) {
return this.inviteByThreePid(
roomId, "email", email, callback
roomId, "email", email, callback,
);
};
@@ -1253,7 +1253,7 @@ MatrixClient.prototype.inviteByEmail = function(roomId, email, callback) {
MatrixClient.prototype.inviteByThreePid = function(roomId, medium, address, callback) {
const path = utils.encodeUri(
"/rooms/$roomId/invite",
{ $roomId: roomId }
{ $roomId: roomId },
);
let identityServerUrl = this.getIdentityServerUrl();
@@ -1335,7 +1335,7 @@ MatrixClient.prototype.forget = function(roomId, deleteRoom, callback) {
MatrixClient.prototype.unban = function(roomId, userId, callback) {
// unbanning = set their state to leave
return _setMembershipState(
this, roomId, userId, "leave", undefined, callback
this, roomId, userId, "leave", undefined, callback,
);
};
@@ -1349,7 +1349,7 @@ MatrixClient.prototype.unban = function(roomId, userId, callback) {
*/
MatrixClient.prototype.kick = function(roomId, userId, reason, callback) {
return _setMembershipState(
this, roomId, userId, "leave", reason, callback
this, roomId, userId, "leave", reason, callback,
);
};
@@ -1372,7 +1372,7 @@ function _setMembershipState(client, roomId, userId, membershipValue, reason,
const path = utils.encodeUri(
"/rooms/$roomId/state/m.room.member/$userId",
{ $roomId: roomId, $userId: userId}
{ $roomId: roomId, $userId: userId},
);
return client._http.authedRequest(callback, "PUT", path, undefined, {
@@ -1405,7 +1405,7 @@ function _membershipChange(client, roomId, userId, membership, reason, callback)
callback, "POST", path, undefined, {
user_id: userId, // may be undefined e.g. on leave
reason: reason,
}
},
);
}
@@ -1439,7 +1439,7 @@ MatrixClient.prototype.setProfileInfo = function(info, data, callback) {
$info: info,
});
return this._http.authedRequest(
callback, "PUT", path, undefined, data
callback, "PUT", path, undefined, data,
);
};
@@ -1451,7 +1451,7 @@ MatrixClient.prototype.setProfileInfo = function(info, data, callback) {
*/
MatrixClient.prototype.setDisplayName = function(name, callback) {
return this.setProfileInfo(
"displayname", { displayname: name }, callback
"displayname", { displayname: name }, callback,
);
};
@@ -1463,7 +1463,7 @@ MatrixClient.prototype.setDisplayName = function(name, callback) {
*/
MatrixClient.prototype.setAvatarUrl = function(url, callback) {
return this.setProfileInfo(
"avatar_url", { avatar_url: url }, callback
"avatar_url", { avatar_url: url }, callback,
);
};
@@ -1483,7 +1483,7 @@ MatrixClient.prototype.setAvatarUrl = function(url, callback) {
MatrixClient.prototype.mxcUrlToHttp =
function(mxcUrl, width, height, resizeMethod, allowDirectLinks) {
return contentRepo.getHttpUriForMxc(
this.baseUrl, mxcUrl, width, height, resizeMethod, allowDirectLinks
this.baseUrl, mxcUrl, width, height, resizeMethod, allowDirectLinks,
);
};
@@ -1510,7 +1510,7 @@ MatrixClient.prototype.setPresence = function(opts, callback) {
throw new Error("Bad presence value: " + opts.presence);
}
return this._http.authedRequest(
callback, "PUT", path, undefined, opts
callback, "PUT", path, undefined, opts,
);
};
@@ -1600,7 +1600,7 @@ MatrixClient.prototype.scrollback = function(room, limit, callback) {
limit = limit - numAdded;
const path = utils.encodeUri(
"/rooms/$roomId/messages", {$roomId: room.roomId}
"/rooms/$roomId/messages", {$roomId: room.roomId},
);
const params = {
from: room.oldState.paginationToken,
@@ -1670,7 +1670,7 @@ MatrixClient.prototype.paginateEventContext = function(eventContext, opts) {
}
const path = utils.encodeUri(
"/rooms/$roomId/messages", {$roomId: eventContext.getEvent().getRoomId()}
"/rooms/$roomId/messages", {$roomId: eventContext.getEvent().getRoomId()},
);
const params = {
from: token,
@@ -1680,7 +1680,7 @@ MatrixClient.prototype.paginateEventContext = function(eventContext, opts) {
const self = this;
const promise =
self._http.authedRequest(undefined, "GET", path, params
self._http.authedRequest(undefined, "GET", path, params,
).then(function(res) {
let token = res.end;
if (res.chunk.length === 0) {
@@ -1734,14 +1734,14 @@ MatrixClient.prototype.getEventTimeline = function(timelineSet, eventId) {
"/rooms/$roomId/context/$eventId", {
$roomId: timelineSet.room.roomId,
$eventId: eventId,
}
},
);
// TODO: we should implement a backoff (as per scrollback()) to deal more
// nicely with HTTP errors.
const self = this;
const promise =
self._http.authedRequest(undefined, "GET", path
self._http.authedRequest(undefined, "GET", path,
).then(function(res) {
if (!res.event) {
throw new Error("'event' not in '/context' result - homeserver too old?");
@@ -1841,7 +1841,7 @@ MatrixClient.prototype.paginateEventTimeline = function(eventTimeline, opts) {
promise =
this._http.authedRequestWithPrefix(undefined, "GET", path, params,
undefined, httpApi.PREFIX_UNSTABLE
undefined, httpApi.PREFIX_UNSTABLE,
).then(function(res) {
const token = res.next_token;
const matrixEvents = [];
@@ -1850,7 +1850,7 @@ MatrixClient.prototype.paginateEventTimeline = function(eventTimeline, opts) {
const notification = res.notifications[i];
const event = self.getEventMapper()(notification.event);
event.setPushActions(
PushProcessor.actionListToActionsObject(notification.actions)
PushProcessor.actionListToActionsObject(notification.actions),
);
event.event.room_id = notification.room_id; // XXX: gutwrenching
matrixEvents[i] = event;
@@ -1877,7 +1877,7 @@ MatrixClient.prototype.paginateEventTimeline = function(eventTimeline, opts) {
}
path = utils.encodeUri(
"/rooms/$roomId/messages", {$roomId: eventTimeline.getRoomId()}
"/rooms/$roomId/messages", {$roomId: eventTimeline.getRoomId()},
);
params = {
from: token,
@@ -1893,7 +1893,7 @@ MatrixClient.prototype.paginateEventTimeline = function(eventTimeline, opts) {
}
promise =
this._http.authedRequest(undefined, "GET", path, params
this._http.authedRequest(undefined, "GET", path, params,
).then(function(res) {
const token = res.end;
const matrixEvents = utils.map(res.chunk, self.getEventMapper());
@@ -2029,7 +2029,7 @@ MatrixClient.prototype.requestRegisterEmailToken = function(email, clientSecret,
sendAttempt, nextLink, callback) {
return this._requestTokenFromEndpoint(
"/register/email/requestToken",
email, clientSecret, sendAttempt, nextLink, callback
email, clientSecret, sendAttempt, nextLink, callback,
);
};
@@ -2057,7 +2057,7 @@ MatrixClient.prototype.requestAdd3pidEmailToken = function(email, clientSecret,
sendAttempt, nextLink, callback) {
return this._requestTokenFromEndpoint(
"/account/3pid/email/requestToken",
email, clientSecret, sendAttempt, nextLink, callback
email, clientSecret, sendAttempt, nextLink, callback,
);
};
@@ -2084,7 +2084,7 @@ MatrixClient.prototype.requestPasswordEmailToken = function(email, clientSecret,
sendAttempt, nextLink, callback) {
return this._requestTokenFromEndpoint(
"/account/password/email/requestToken",
email, clientSecret, sendAttempt, nextLink, callback
email, clientSecret, sendAttempt, nextLink, callback,
);
};
@@ -2117,7 +2117,7 @@ MatrixClient.prototype._requestTokenFromEndpoint = function(endpoint,
};
return this._http.request(
callback, "POST", endpoint, undefined,
params
params,
);
};
@@ -2143,7 +2143,7 @@ MatrixClient.prototype.getRoomPushRule = function(scope, roomId) {
}
} else {
throw new Error(
"SyncApi.sync() must be done before accessing to push rules."
"SyncApi.sync() must be done before accessing to push rules.",
);
}
};
@@ -2295,7 +2295,7 @@ MatrixClient.prototype.searchRoomEvents = function(opts) {
};
return this.search({body: body}).then(
this._processRoomEventsSearch.bind(this, searchResults)
this._processRoomEventsSearch.bind(this, searchResults),
);
};
@@ -2325,7 +2325,7 @@ MatrixClient.prototype.backPaginateRoomEventsSearch = function(searchResults) {
};
const promise = this.search(searchOpts).then(
this._processRoomEventsSearch.bind(this, searchResults)
this._processRoomEventsSearch.bind(this, searchResults),
).finally(function() {
searchResults.pendingRequest = null;
});
@@ -2415,11 +2415,11 @@ MatrixClient.prototype.createFilter = function(content) {
$userId: this.credentials.userId,
});
return this._http.authedRequest(
undefined, "POST", path, undefined, content
undefined, "POST", path, undefined, content,
).then(function(response) {
// persist the filter
const filter = Filter.fromJson(
self.credentials.userId, response.filter_id, content
self.credentials.userId, response.filter_id, content,
);
self.store.storeFilter(filter);
return filter;
@@ -2450,11 +2450,11 @@ MatrixClient.prototype.getFilter = function(userId, filterId, allowCached) {
});
return this._http.authedRequest(
undefined, "GET", path, undefined, undefined
undefined, "GET", path, undefined, undefined,
).then(function(response) {
// persist the filter
const filter = Filter.fromJson(
userId, filterId, response
userId, filterId, response,
);
self.store.storeFilter(filter);
return filter;
@@ -2474,7 +2474,7 @@ MatrixClient.prototype.getOrCreateFilter = function(filterName, filter) {
if (filterId) {
// check that the existing filter matches our expectations
promise = self.getFilter(self.credentials.userId,
filterId, true
filterId, true,
).then(function(existingFilter) {
const oldDef = existingFilter.getDefinition();
const newDef = filter.getDefinition();
@@ -2516,7 +2516,7 @@ MatrixClient.prototype.getOrCreateFilter = function(filterName, filter) {
}
// create a new filter
return self.createFilter(filter.getDefinition()
return self.createFilter(filter.getDefinition(),
).then(function(createdFilter) {
// debuglog("Created new filter ID %s: %s", createdFilter.filterId,
// JSON.stringify(createdFilter.getDefinition()));
@@ -2540,7 +2540,7 @@ MatrixClient.prototype.getOpenIdToken = function() {
});
return this._http.authedRequest(
undefined, "POST", path, undefined, {}
undefined, "POST", path, undefined, {},
);
};
@@ -2730,7 +2730,7 @@ function setupCallEventHandler(client) {
console.log(
"WARN: Already have a MatrixCall with id %s but got an " +
"invite. Clobbering.",
content.call_id
content.call_id,
);
}
@@ -2738,7 +2738,7 @@ function setupCallEventHandler(client) {
if (!call) {
console.log(
"Incoming call ID " + content.call_id + " but this client " +
"doesn't support WebRTC"
"doesn't support WebRTC",
);
// don't hang up the call: there could be other clients
// connected that do support WebRTC and declining the
@@ -2754,7 +2754,7 @@ function setupCallEventHandler(client) {
if (candidatesByCall[call.callId]) {
for (i = 0; i < candidatesByCall[call.callId].length; i++) {
call._gotRemoteIceCandidate(
candidatesByCall[call.callId][i]
candidatesByCall[call.callId][i],
);
}
}
@@ -2783,14 +2783,14 @@ function setupCallEventHandler(client) {
existingCall.callId > call.callId) {
console.log(
"Glare detected: answering incoming call " + call.callId +
" and canceling outgoing call " + existingCall.callId
" and canceling outgoing call " + existingCall.callId,
);
existingCall._replacedBy(call);
call.answer();
} else {
console.log(
"Glare detected: rejecting incoming call " + call.callId +
" and keeping outgoing call " + existingCall.callId
" and keeping outgoing call " + existingCall.callId,
);
call.hangup();
}