You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
Consistent values between various account data interfaces
This commit is contained in:
@@ -246,7 +246,7 @@ export class EncryptionSetupOperation {
|
|||||||
* implementing the methods related to account data in MatrixClient
|
* implementing the methods related to account data in MatrixClient
|
||||||
*/
|
*/
|
||||||
class AccountDataClientAdapter extends EventEmitter {
|
class AccountDataClientAdapter extends EventEmitter {
|
||||||
public readonly values = new Map<string, object>();
|
public readonly values = new Map<string, MatrixEvent>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Object.<String, MatrixEvent>} existingValues existing account data
|
* @param {Object.<String, MatrixEvent>} existingValues existing account data
|
||||||
@@ -259,7 +259,7 @@ class AccountDataClientAdapter extends EventEmitter {
|
|||||||
* @param {String} type
|
* @param {String} type
|
||||||
* @return {Promise<Object>} the content of the account data
|
* @return {Promise<Object>} the content of the account data
|
||||||
*/
|
*/
|
||||||
public getAccountDataFromServer(type: string): Promise<object> {
|
public getAccountDataFromServer(type: string): Promise<any> {
|
||||||
return Promise.resolve(this.getAccountData(type));
|
return Promise.resolve(this.getAccountData(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,7 +267,7 @@ class AccountDataClientAdapter extends EventEmitter {
|
|||||||
* @param {String} type
|
* @param {String} type
|
||||||
* @return {Object} the content of the account data
|
* @return {Object} the content of the account data
|
||||||
*/
|
*/
|
||||||
public getAccountData(type: string): object {
|
public getAccountData(type: string): MatrixEvent {
|
||||||
const modifiedValue = this.values.get(type);
|
const modifiedValue = this.values.get(type);
|
||||||
if (modifiedValue) {
|
if (modifiedValue) {
|
||||||
return modifiedValue;
|
return modifiedValue;
|
||||||
@@ -284,7 +284,7 @@ class AccountDataClientAdapter extends EventEmitter {
|
|||||||
* @param {Object} content
|
* @param {Object} content
|
||||||
* @return {Promise}
|
* @return {Promise}
|
||||||
*/
|
*/
|
||||||
public setAccountData(type: string, content: object): Promise<void> {
|
public setAccountData(type: string, content: any): Promise<void> {
|
||||||
const lastEvent = this.values.get(type);
|
const lastEvent = this.values.get(type);
|
||||||
this.values.set(type, content);
|
this.values.set(type, content);
|
||||||
// ensure accountData is emitted on the next tick,
|
// ensure accountData is emitted on the next tick,
|
||||||
|
|||||||
Reference in New Issue
Block a user