Return proto wrapper instead of proto class

This commit is contained in:
Franck Royer 2021-10-19 11:26:43 +11:00
parent 5cbc4b90fb
commit e25f3c0b44
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
1 changed files with 5 additions and 2 deletions

View File

@ -1,12 +1,13 @@
import { Reader } from "protobufjs"; import { Reader } from "protobufjs";
import { ChatIdentity } from "../proto/communities/v1/chat_identity";
import * as proto from "../proto/communities/v1/communities"; import * as proto from "../proto/communities/v1/communities";
import { import {
CommunityMember, CommunityMember,
CommunityPermissions, CommunityPermissions,
} from "../proto/communities/v1/communities"; } from "../proto/communities/v1/communities";
import { ChatIdentity } from "./chat_identity";
export class CommunityChat { export class CommunityChat {
public constructor(public proto: proto.CommunityChat) {} public constructor(public proto: proto.CommunityChat) {}
@ -41,7 +42,9 @@ export class CommunityChat {
} }
public get identity(): ChatIdentity | undefined { public get identity(): ChatIdentity | undefined {
return this.proto.identity; if (!this.proto.identity) return;
return new ChatIdentity(this.proto.identity);
} }
// TODO: Document this // TODO: Document this