You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-28 05:03:59 +03:00
fix review feedback
This commit is contained in:
@@ -909,7 +909,7 @@ MatrixClient.prototype.getUsers = function() {
|
|||||||
/**
|
/**
|
||||||
* Set account data event for the current user.
|
* Set account data event for the current user.
|
||||||
* @param {string} eventType The event type
|
* @param {string} eventType The event type
|
||||||
* @param {Object} the contents object for the event
|
* @param {Object} content the contents object for the event
|
||||||
* @param {module:client.callback} callback Optional.
|
* @param {module:client.callback} callback Optional.
|
||||||
* @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.
|
||||||
|
|||||||
@@ -250,7 +250,9 @@ module.exports.MatrixInMemoryStore.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Store user-scoped account data events
|
* Store user-scoped account data events.
|
||||||
|
* N.B. that account data only allows a single event per type, so multiple
|
||||||
|
* events with the same type will replace each other.
|
||||||
* @param {Array<MatrixEvent>} events The events to store.
|
* @param {Array<MatrixEvent>} events The events to store.
|
||||||
*/
|
*/
|
||||||
storeAccountDataEvents: function(events) {
|
storeAccountDataEvents: function(events) {
|
||||||
@@ -263,7 +265,7 @@ module.exports.MatrixInMemoryStore.prototype = {
|
|||||||
/**
|
/**
|
||||||
* Get account data event by event type
|
* Get account data event by event type
|
||||||
* @param {string} eventType The event type being queried
|
* @param {string} eventType The event type being queried
|
||||||
* @return {MatrixEvent} the user account_data event of given type
|
* @return {?MatrixEvent} the user account_data event of given type, if any
|
||||||
*/
|
*/
|
||||||
getAccountData: function(eventType) {
|
getAccountData: function(eventType) {
|
||||||
return this.accountData[eventType];
|
return this.accountData[eventType];
|
||||||
|
|||||||
14
lib/sync.js
14
lib/sync.js
@@ -608,13 +608,13 @@ SyncApi.prototype._processSyncResponse = function(syncToken, data) {
|
|||||||
|
|
||||||
// handle non-room account_data
|
// handle non-room account_data
|
||||||
if (data.account_data && utils.isArray(data.account_data.events)) {
|
if (data.account_data && utils.isArray(data.account_data.events)) {
|
||||||
client.store.storeAccountDataEvents(
|
var events = data.account_data.events.map(client.getEventMapper());
|
||||||
data.account_data.events.map(client.getEventMapper()).map(
|
client.store.storeAccountDataEvents(events);
|
||||||
function(accountDataEvent) {
|
events.forEach(
|
||||||
client.emit("accountData", accountDataEvent);
|
function(accountDataEvent) {
|
||||||
return accountDataEvent;
|
client.emit("accountData", accountDataEvent);
|
||||||
}
|
return accountDataEvent;
|
||||||
)
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user