From 4e74f7e9eafbc294273da38c264343d3cdd88053 Mon Sep 17 00:00:00 2001 From: Kerry Archibald Date: Thu, 16 Feb 2023 15:06:55 +1300 Subject: [PATCH 1/2] expose end event id on poll model --- spec/unit/models/poll.spec.ts | 2 ++ src/models/poll.ts | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/spec/unit/models/poll.spec.ts b/spec/unit/models/poll.spec.ts index 245d5646501..d0261a3f342 100644 --- a/spec/unit/models/poll.spec.ts +++ b/spec/unit/models/poll.spec.ts @@ -76,6 +76,7 @@ describe("Poll", () => { expect(poll.pollId).toEqual(basePollStartEvent.getId()); expect(poll.pollEvent).toEqual(basePollStartEvent.unstableExtensibleEvent); expect(poll.isEnded).toBe(false); + expect(poll.endEventId).toBe(undefined); }); it("throws when poll start has no room id", () => { @@ -208,6 +209,7 @@ describe("Poll", () => { expect(maySendRedactionForEventSpy).toHaveBeenCalledWith(basePollStartEvent, "@bob@server.org"); expect(poll.isEnded).toBe(true); + expect(poll.endEventId).toBe(stablePollEndEvent.getId()!); expect(poll.emit).toHaveBeenCalledWith(PollEvent.End); }); diff --git a/src/models/poll.ts b/src/models/poll.ts index 8a080ef9015..89f18165377 100644 --- a/src/models/poll.ts +++ b/src/models/poll.ts @@ -80,6 +80,10 @@ export class Poll extends TypedEventEmitter, P return this.rootEvent.getId()!; } + public get endEventId(): string | undefined { + return this.endEvent?.getId(); + } + public get isEnded(): boolean { return !!this.endEvent; } From d5dbe02acafb89e0d49386b86aa4f914c4d99225 Mon Sep 17 00:00:00 2001 From: Kerry Archibald Date: Mon, 20 Feb 2023 13:54:53 +1300 Subject: [PATCH 2/2] rebuild