Add type for invite rom

This commit is contained in:
Ajay Bura 2022-06-29 15:58:51 +05:30
parent eb51e76f9d
commit 83b233b97e
3 changed files with 8 additions and 4 deletions

View file

@ -415,7 +415,7 @@ export class BaseRoom extends EventEmitter {
} }
get type() { get type() {
return this._summary.data.type; return this._summary.data.type ?? undefined;
} }
get lastMessageTimestamp() { get lastMessageTimestamp() {

View file

@ -61,6 +61,10 @@ export class Invite extends EventEmitter {
return this._inviteData.avatarColorId || this.id; return this._inviteData.avatarColorId || this.id;
} }
get type() {
return this._inviteData.type ?? undefined;
}
get timestamp() { get timestamp() {
return this._inviteData.timestamp; return this._inviteData.timestamp;
} }
@ -89,7 +93,7 @@ export class Invite extends EventEmitter {
await this._platform.logger.wrapOrRun(log, "acceptInvite", async log => { await this._platform.logger.wrapOrRun(log, "acceptInvite", async log => {
this._accepting = true; this._accepting = true;
this._emitChange("accepting"); this._emitChange("accepting");
await this._hsApi.join(this._roomId, {log}).response(); await this._hsApi.joinIdOrAlias(this.canonicalAlias ?? this._roomId, {log}).response();
}); });
} }
@ -189,7 +193,7 @@ export class Invite extends EventEmitter {
roomId: this.id, roomId: this.id,
isEncrypted: !!summaryData.encryption, isEncrypted: !!summaryData.encryption,
isDirectMessage: summaryData.isDirectMessage, isDirectMessage: summaryData.isDirectMessage,
// type: type: summaryData.type,
name, name,
avatarUrl, avatarUrl,
avatarColorId, avatarColorId,

View file

@ -163,7 +163,7 @@ export class GapWriter {
if (!Array.isArray(chunk)) { if (!Array.isArray(chunk)) {
throw new Error("Invalid chunk in response"); throw new Error("Invalid chunk in response");
} }
if (typeof end !== "string") { if (typeof end !== "string" && typeof end !== "undefined") {
throw new Error("Invalid end token in response"); throw new Error("Invalid end token in response");
} }