diff --git a/src/client.ts b/src/client.ts index 220795e8b65..711bf3e4e5e 100644 --- a/src/client.ts +++ b/src/client.ts @@ -5063,26 +5063,6 @@ export class MatrixClient extends TypedEventEmitter { // eslint-disable-line - const type = "im.vector.user_status"; - return Promise.all(this.getRooms().map(async (room) => { - const isJoined = room.getMyMembership() === "join"; - const looksLikeDm = room.getInvitedAndJoinedMemberCount() === 2; - if (!isJoined || !looksLikeDm) return; - // Check power level separately as it's a bit more expensive. - const maySend = room.currentState.mayClientSendStateEvent(type, this); - if (!maySend) return; - await this.sendStateEvent(room.roomId, type, { status: newMessage }, this.getUserId()); - })).then(); // .then to fix return type - } - /** * @param {Object} opts Options to apply * @param {string} opts.presence One of "online", "offline" or "unavailable" diff --git a/src/models/user.ts b/src/models/user.ts index aad80e57501..df580b0f1f5 100644 --- a/src/models/user.ts +++ b/src/models/user.ts @@ -27,8 +27,6 @@ export enum UserEvent { Presence = "User.presence", CurrentlyActive = "User.currentlyActive", LastPresenceTs = "User.lastPresenceTs", - /* @deprecated */ - _UnstableStatusMessage = "User.unstable_statusMessage", } export type UserEventHandlerMap = { @@ -37,7 +35,6 @@ export type UserEventHandlerMap = { [UserEvent.Presence]: (event: MatrixEvent | undefined, user: User) => void; [UserEvent.CurrentlyActive]: (event: MatrixEvent | undefined, user: User) => void; [UserEvent.LastPresenceTs]: (event: MatrixEvent | undefined, user: User) => void; - [UserEvent._UnstableStatusMessage]: (user: User) => void; }; export class User extends TypedEventEmitter { @@ -59,8 +56,6 @@ export class User extends TypedEventEmitter { presence: null, profile: null, }; - // eslint-disable-next-line camelcase - public unstable_statusMessage = ""; /** * Construct a new User. A User must have an ID and can optionally have extra @@ -81,9 +76,6 @@ export class User extends TypedEventEmitter { * when a user was last active. * @prop {Boolean} currentlyActive Whether we should consider lastActiveAgo to be * an approximation and that the user should be seen as active 'now' - * @prop {string} unstable_statusMessage The status message for the user, if known. This is - * different from the presenceStatusMsg in that this is not tied to - * the user's presence, and should be represented differently. * @prop {Object} events The events describing this user. * @prop {MatrixEvent} events.presence The m.presence event for this user. */ @@ -219,19 +211,6 @@ export class User extends TypedEventEmitter { public getLastActiveTs(): number { return this.lastPresenceTs - this.lastActiveAgo; } - - /** - * Manually set the user's status message. - * @param {MatrixEvent} event The im.vector.user_status event. - * @fires module:client~MatrixClient#event:"User.unstable_statusMessage" - */ - // eslint-disable-next-line - public unstable_updateStatusMessage(event: MatrixEvent): void { - if (!event.getContent()) this.unstable_statusMessage = ""; - else this.unstable_statusMessage = event.getContent()["status"]; - this.updateModifiedTime(); - this.emit(UserEvent._UnstableStatusMessage, this); - } } /** diff --git a/src/sync.ts b/src/sync.ts index 30df2cb7e6c..0791920a9ff 100644 --- a/src/sync.ts +++ b/src/sync.ts @@ -1295,16 +1295,6 @@ export class SyncApi { if (e.isState() && e.getType() == "m.room.encryption" && this.opts.crypto) { await this.opts.crypto.onCryptoEvent(e); } - if (e.isState() && e.getType() === "im.vector.user_status") { - let user = client.store.getUser(e.getStateKey()); - if (user) { - user.unstable_updateStatusMessage(e); - } else { - user = createNewUser(client, e.getStateKey()); - user.unstable_updateStatusMessage(e); - client.store.storeUser(user); - } - } }; await utils.promiseMapSeries(stateEvents, processRoomEvent);