Fix state events being hidden from widgets in read_events actions (#29954)
This widget driver method was mistakenly filtering all state events out of the responses to read_events fromWidget actions. This was a hold-over from back when read_events had two different behaviors depending on whether you specified a state_key (i.e. before the introduction of the update_state action).
This commit is contained in:
@@ -498,9 +498,9 @@ export class StopGapWidgetDriver extends WidgetDriver {
|
||||
if (results.length >= limit) break;
|
||||
if (since !== undefined && ev.getId() === since) break;
|
||||
|
||||
if (ev.getType() !== eventType || ev.isState()) continue;
|
||||
if (ev.getType() !== eventType) continue;
|
||||
if (eventType === EventType.RoomMessage && msgtype && msgtype !== ev.getContent()["msgtype"]) continue;
|
||||
if (ev.getStateKey() !== undefined && stateKey !== undefined && ev.getStateKey() !== stateKey) continue;
|
||||
if (stateKey !== undefined && ev.getStateKey() !== stateKey) continue;
|
||||
results.push(ev);
|
||||
}
|
||||
|
||||
|
||||
@@ -708,6 +708,7 @@ describe("StopGapWidgetDriver", () => {
|
||||
id: "$event-id2",
|
||||
type: "org.example.foo",
|
||||
user: "@alice:example.org",
|
||||
skey: "",
|
||||
content: { hello: "world" },
|
||||
room: "!1:example.org",
|
||||
});
|
||||
@@ -726,6 +727,12 @@ describe("StopGapWidgetDriver", () => {
|
||||
).toEqual([event2, event1].map((e) => e.getEffectiveEvent()));
|
||||
});
|
||||
|
||||
it("reads state events", async () => {
|
||||
expect(
|
||||
await driver.readRoomTimeline("!1:example.org", "org.example.foo", undefined, "", 10, undefined),
|
||||
).toEqual([event2.getEffectiveEvent()]);
|
||||
});
|
||||
|
||||
it("reads up to a limit", async () => {
|
||||
expect(
|
||||
await driver.readRoomTimeline("!1:example.org", "org.example.foo", undefined, undefined, 1, undefined),
|
||||
|
||||
Reference in New Issue
Block a user