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() {
return this._summary.data.type;
return this._summary.data.type ?? undefined;
}
get lastMessageTimestamp() {

View File

@ -61,6 +61,10 @@ export class Invite extends EventEmitter {
return this._inviteData.avatarColorId || this.id;
}
get type() {
return this._inviteData.type ?? undefined;
}
get timestamp() {
return this._inviteData.timestamp;
}
@ -89,7 +93,7 @@ export class Invite extends EventEmitter {
await this._platform.logger.wrapOrRun(log, "acceptInvite", async log => {
this._accepting = true;
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,
isEncrypted: !!summaryData.encryption,
isDirectMessage: summaryData.isDirectMessage,
// type:
type: summaryData.type,
name,
avatarUrl,
avatarColorId,

View File

@ -163,7 +163,7 @@ export class GapWriter {
if (!Array.isArray(chunk)) {
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");
}