You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-25 05:23:13 +03:00
Fix more type definitions
This commit is contained in:
@@ -2730,7 +2730,7 @@ export class MatrixClient extends EventEmitter {
|
||||
* @return {Promise} Resolves: TODO
|
||||
* @return {module:http-api.MatrixError} Rejects: with an error response.
|
||||
*/
|
||||
public setAccountData(eventType: string, content: any, callback?: Callback): Promise<void> {
|
||||
public setAccountData(eventType: EventType | string, content: any, callback?: Callback): Promise<void> {
|
||||
const path = utils.encodeUri("/user/$userId/account_data/$type", {
|
||||
$userId: this.credentials.userId,
|
||||
$type: eventType,
|
||||
@@ -2749,7 +2749,7 @@ export class MatrixClient extends EventEmitter {
|
||||
* @param {string} eventType The event type
|
||||
* @return {?object} The contents of the given account data event
|
||||
*/
|
||||
public getAccountData(eventType: string): any {
|
||||
public getAccountData(eventType: string): MatrixEvent {
|
||||
return this.store.getAccountData(eventType);
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ interface IUnsigned {
|
||||
redacted_because?: IEvent;
|
||||
}
|
||||
|
||||
interface IEvent {
|
||||
export interface IEvent {
|
||||
event_id: string;
|
||||
type: string;
|
||||
content: IContent;
|
||||
|
||||
@@ -42,6 +42,7 @@ export class User extends EventEmitter {
|
||||
presence: null,
|
||||
profile: null,
|
||||
};
|
||||
// eslint-disable-next-line camelcase
|
||||
public unstable_statusMessage = "";
|
||||
|
||||
/**
|
||||
@@ -208,7 +209,7 @@ export class User extends EventEmitter {
|
||||
* @fires module:client~MatrixClient#event:"User.unstable_statusMessage"
|
||||
*/
|
||||
// eslint-disable-next-line camelcase
|
||||
public _unstable_updateStatusMessage(event: MatrixEvent): void {
|
||||
public unstable_updateStatusMessage(event: MatrixEvent): void {
|
||||
if (!event.getContent()) this.unstable_statusMessage = "";
|
||||
else this.unstable_statusMessage = event.getContent()["status"];
|
||||
this.updateModifiedTime();
|
||||
|
||||
@@ -1272,10 +1272,10 @@ SyncApi.prototype._processSyncResponse = async function(
|
||||
if (e.isState() && e.getType() === "im.vector.user_status") {
|
||||
let user = client.store.getUser(e.getStateKey());
|
||||
if (user) {
|
||||
user._unstable_updateStatusMessage(e);
|
||||
user.unstable_updateStatusMessage(e);
|
||||
} else {
|
||||
user = createNewUser(client, e.getStateKey());
|
||||
user._unstable_updateStatusMessage(e);
|
||||
user.unstable_updateStatusMessage(e);
|
||||
client.store.storeUser(user);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user