forked from mystiq/hydrogen-web
Add room type in room summary
This commit is contained in:
parent
340c3aa068
commit
004e3cb924
4 changed files with 8 additions and 1 deletions
|
@ -56,6 +56,7 @@ const PUSHER_KEY = "pusher";
|
|||
export class Session {
|
||||
// sessionInfo contains deviceId, userId and homeserver
|
||||
constructor({storage, hsApi, sessionInfo, olm, olmWorker, platform, mediaRepository}) {
|
||||
window.session = this
|
||||
this._platform = platform;
|
||||
this._storage = storage;
|
||||
this._hsApi = hsApi;
|
||||
|
|
|
@ -409,6 +409,10 @@ export class BaseRoom extends EventEmitter {
|
|||
return this._roomId;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return this._summary.data.type;
|
||||
}
|
||||
|
||||
get lastMessageTimestamp() {
|
||||
return this._summary.data.lastMessageTimestamp;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import {WrappedError} from "../error.js"
|
|||
import {Heroes} from "./members/Heroes.js";
|
||||
import {AttachmentUpload} from "./AttachmentUpload.js";
|
||||
import {DecryptionSource} from "../e2ee/common.js";
|
||||
import {iterateResponseStateEvents} from "./common.js";
|
||||
import {iterateResponseStateEvents} from "./common";
|
||||
import {PowerLevels, EVENT_TYPE as POWERLEVELS_EVENT_TYPE } from "./PowerLevels.js";
|
||||
|
||||
const EVENT_ENCRYPTED_TYPE = "m.room.encrypted";
|
||||
|
|
|
@ -82,6 +82,7 @@ export function processStateEvent(data, event, ownUserId) {
|
|||
if (event.type === "m.room.create") {
|
||||
data = data.cloneIfNeeded();
|
||||
data.lastMessageTimestamp = event.origin_server_ts;
|
||||
data.type = event.content?.type ?? null;
|
||||
} else if (event.type === "m.room.encryption") {
|
||||
const algorithm = event.content?.algorithm;
|
||||
if (!data.encryption && algorithm === MEGOLM_ALGORITHM) {
|
||||
|
@ -167,6 +168,7 @@ export class SummaryData {
|
|||
constructor(copy, roomId) {
|
||||
this.roomId = copy ? copy.roomId : roomId;
|
||||
this.name = copy ? copy.name : null;
|
||||
this.type = copy ? copy.type : null;
|
||||
this.lastMessageTimestamp = copy ? copy.lastMessageTimestamp : null;
|
||||
this.isUnread = copy ? copy.isUnread : false;
|
||||
this.encryption = copy ? copy.encryption : null;
|
||||
|
|
Loading…
Reference in a new issue