Move all polls processing to events-sdk & prep for stable polls (#7517)

* Move all polls processing to events-sdk

This makes polls support the full range of extensible events (both parsing and generation).

* Appease the linter

* Fix & update tests

* Update events-sdk for polls bugfix

* Update events-sdk for typechecking

* Add missing type cast

* Update per review
This commit is contained in:
Travis Ralston 2022-01-17 10:06:30 -07:00 committed by GitHub
parent 12e967a97c
commit 65987e6b72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 727 additions and 299 deletions

View file

@ -1,5 +1,5 @@
/*
Copyright 2021 The Matrix.org Foundation C.I.C.
Copyright 2021 - 2022 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -19,13 +19,16 @@ import { mount, ReactWrapper } from "enzyme";
import { Callback, IContent, MatrixClient, MatrixEvent, Room } from "matrix-js-sdk";
import { ISendEventResponse } from "matrix-js-sdk/src/@types/requests";
import { Relations } from "matrix-js-sdk/src/models/relations";
import { RelatedRelations } from "matrix-js-sdk/src/models/related-relations";
import {
IPollAnswer,
IPollContent,
POLL_END_EVENT_TYPE,
POLL_RESPONSE_EVENT_TYPE,
} from "matrix-js-sdk/src/@types/polls";
import { TEXT_NODE_TYPE } from "matrix-js-sdk/src/@types/extensible_events";
M_POLL_END,
M_POLL_KIND_DISCLOSED,
M_POLL_RESPONSE,
M_POLL_START,
M_POLL_START_EVENT_CONTENT,
M_TEXT,
POLL_ANSWER,
} from "matrix-events-sdk";
import * as TestUtils from "../../../test-utils";
import sdk from "../../../skinned-sdk";
@ -56,8 +59,8 @@ describe("MPollBody", () => {
allVotes(
{ getRoomId: () => "$room" } as MatrixEvent,
MatrixClientPeg.get(),
newVoteRelations([]),
newEndRelations([]),
new RelatedRelations([newVoteRelations([])]),
new RelatedRelations([newEndRelations([])]),
),
).toEqual([]);
});
@ -67,34 +70,43 @@ describe("MPollBody", () => {
const ev2 = responseEvent();
const badEvent = badResponseEvent();
const voteRelations = newVoteRelations([ev1, badEvent, ev2]);
const voteRelations = new RelatedRelations([
newVoteRelations([ev1, badEvent, ev2]),
]);
expect(
allVotes(
{ getRoomId: () => "$room" } as MatrixEvent,
MatrixClientPeg.get(),
voteRelations,
newEndRelations([]),
new RelatedRelations([newEndRelations([])]),
),
).toEqual([
new UserVote(
ev1.getTs(),
ev1.getSender(),
ev1.getContent()[POLL_RESPONSE_EVENT_TYPE.name].answers,
ev1.getContent()[M_POLL_RESPONSE.name].answers,
),
new UserVote(
badEvent.getTs(),
badEvent.getSender(),
[], // should be spoiled
),
new UserVote(
ev2.getTs(),
ev2.getSender(),
ev2.getContent()[POLL_RESPONSE_EVENT_TYPE.name].answers,
ev2.getContent()[M_POLL_RESPONSE.name].answers,
),
]);
});
it("finds the first end poll event", () => {
const endRelations = newEndRelations([
endEvent("@me:example.com", 25),
endEvent("@me:example.com", 12),
endEvent("@me:example.com", 45),
endEvent("@me:example.com", 13),
const endRelations = new RelatedRelations([
newEndRelations([
endEvent("@me:example.com", 25),
endEvent("@me:example.com", 12),
endEvent("@me:example.com", 45),
endEvent("@me:example.com", 13),
]),
]);
const matrixClient = TestUtils.createTestClient();
@ -110,11 +122,13 @@ describe("MPollBody", () => {
});
it("ignores unauthorised end poll event when finding end ts", () => {
const endRelations = newEndRelations([
endEvent("@me:example.com", 25),
endEvent("@unauthorised:example.com", 12),
endEvent("@me:example.com", 45),
endEvent("@me:example.com", 13),
const endRelations = new RelatedRelations([
newEndRelations([
endEvent("@me:example.com", 25),
endEvent("@unauthorised:example.com", 12),
endEvent("@me:example.com", 45),
endEvent("@me:example.com", 13),
]),
]);
const matrixClient = TestUtils.createTestClient();
@ -130,15 +144,19 @@ describe("MPollBody", () => {
});
it("counts only votes before the end poll event", () => {
const voteRelations = newVoteRelations([
responseEvent("sf@matrix.org", "wings", 13),
responseEvent("jr@matrix.org", "poutine", 40),
responseEvent("ak@matrix.org", "poutine", 37),
responseEvent("id@matrix.org", "wings", 13),
responseEvent("ps@matrix.org", "wings", 19),
const voteRelations = new RelatedRelations([
newVoteRelations([
responseEvent("sf@matrix.org", "wings", 13),
responseEvent("jr@matrix.org", "poutine", 40),
responseEvent("ak@matrix.org", "poutine", 37),
responseEvent("id@matrix.org", "wings", 13),
responseEvent("ps@matrix.org", "wings", 19),
]),
]);
const endRelations = newEndRelations([
endEvent("@me:example.com", 25),
const endRelations = new RelatedRelations([
newEndRelations([
endEvent("@me:example.com", 25),
]),
]);
expect(
allVotes(
@ -298,7 +316,7 @@ describe("MPollBody", () => {
const body = newMPollBody(votes);
const props: IBodyProps = body.instance().props as IBodyProps;
const voteRelations: Relations = props.getRelationsForEvent(
"$mypoll", "m.reference", POLL_RESPONSE_EVENT_TYPE.name);
"$mypoll", "m.reference", M_POLL_RESPONSE.name);
clickRadio(body, "pizza");
// When a new vote from me comes in
@ -319,7 +337,7 @@ describe("MPollBody", () => {
const body = newMPollBody(votes);
const props: IBodyProps = body.instance().props as IBodyProps;
const voteRelations: Relations = props.getRelationsForEvent(
"$mypoll", "m.reference", POLL_RESPONSE_EVENT_TYPE.name);
"$mypoll", "m.reference", M_POLL_RESPONSE.name);
clickRadio(body, "pizza");
// When a new vote from someone else comes in
@ -400,7 +418,7 @@ describe("MPollBody", () => {
});
it("treats any invalid answer as a spoiled ballot", () => {
// Note that tr's second vote has a valid first answer, but
// Note that uy's second vote has a valid first answer, but
// the ballot is still spoiled because the second answer is
// invalid, even though we would ignore it if we continued.
const votes = [
@ -442,14 +460,16 @@ describe("MPollBody", () => {
expect(body.html()).toBe("");
});
it("renders nothing if poll has more than 20 answers", () => {
const answers = [...Array(21).keys()].map((i) => {
return { "id": `id${i}`, "org.matrix.msc1767.text": `Name ${i}` };
it("renders the first 20 answers if 21 were given", () => {
const answers = Array.from(Array(21).keys()).map((i) => {
return { "id": `id${i}`, [M_TEXT.name]: `Name ${i}` };
});
const votes = [];
const ends = [];
const body = newMPollBody(votes, ends, answers);
expect(body.html()).toBe("");
expect(
body.find('.mx_MPollBody_option').length,
).toBe(20);
});
it("sends a vote event when I choose an option", () => {
@ -835,7 +855,7 @@ describe("MPollBody", () => {
(eventId: string, relationType: string, eventType: string) => {
expect(eventId).toBe("$mypoll");
expect(relationType).toBe("m.reference");
expect(eventType).toBe(POLL_END_EVENT_TYPE.name);
expect(M_POLL_END.matches(eventType)).toBe(true);
return undefined;
};
expect(
@ -926,11 +946,11 @@ describe("MPollBody", () => {
});
function newVoteRelations(relationEvents: Array<MatrixEvent>): Relations {
return newRelations(relationEvents, POLL_RESPONSE_EVENT_TYPE.name);
return newRelations(relationEvents, M_POLL_RESPONSE.name);
}
function newEndRelations(relationEvents: Array<MatrixEvent>): Relations {
return newRelations(relationEvents, POLL_END_EVENT_TYPE.name);
return newRelations(relationEvents, M_POLL_END.name);
}
function newRelations(
@ -947,22 +967,14 @@ function newRelations(
function newMPollBody(
relationEvents: Array<MatrixEvent>,
endEvents: Array<MatrixEvent> = [],
answers?: IPollAnswer[],
answers?: POLL_ANSWER[],
): ReactWrapper {
const voteRelations = new Relations(
"m.reference", POLL_RESPONSE_EVENT_TYPE.name, null);
for (const ev of relationEvents) {
voteRelations.addEvent(ev);
}
const endRelations = new Relations(
"m.reference", POLL_END_EVENT_TYPE.name, null);
for (const ev of endEvents) {
endRelations.addEvent(ev);
}
const voteRelations = newVoteRelations(relationEvents);
const endRelations = newEndRelations(endEvents);
return mount(<MPollBody
mxEvent={new MatrixEvent({
"type": M_POLL_START.name,
"event_id": "$mypoll",
"room_id": "#myroom:example.com",
"content": newPollStart(answers),
@ -971,9 +983,9 @@ function newMPollBody(
(eventId: string, relationType: string, eventType: string) => {
expect(eventId).toBe("$mypoll");
expect(relationType).toBe("m.reference");
if (POLL_RESPONSE_EVENT_TYPE.matches(eventType)) {
if (M_POLL_RESPONSE.matches(eventType)) {
return voteRelations;
} else if (POLL_END_EVENT_TYPE.matches(eventType)) {
} else if (M_POLL_END.matches(eventType)) {
return endRelations;
} else {
fail("Unexpected eventType: " + eventType);
@ -1023,25 +1035,25 @@ function endedVotesCount(wrapper: ReactWrapper, value: string): string {
).text();
}
function newPollStart(answers?: IPollAnswer[]): IPollContent {
function newPollStart(answers?: POLL_ANSWER[]): M_POLL_START_EVENT_CONTENT {
if (!answers) {
answers = [
{ "id": "pizza", "org.matrix.msc1767.text": "Pizza" },
{ "id": "poutine", "org.matrix.msc1767.text": "Poutine" },
{ "id": "italian", "org.matrix.msc1767.text": "Italian" },
{ "id": "wings", "org.matrix.msc1767.text": "Wings" },
{ "id": "pizza", [M_TEXT.name]: "Pizza" },
{ "id": "poutine", [M_TEXT.name]: "Poutine" },
{ "id": "italian", [M_TEXT.name]: "Italian" },
{ "id": "wings", [M_TEXT.name]: "Wings" },
];
}
return {
"org.matrix.msc3381.poll.start": {
[M_POLL_START.name]: {
"question": {
"org.matrix.msc1767.text": "What should we order for the party?",
[M_TEXT.name]: "What should we order for the party?",
},
"kind": "org.matrix.msc3381.poll.disclosed",
"kind": M_POLL_KIND_DISCLOSED.name,
"answers": answers,
},
"org.matrix.msc1767.text": "What should we order for the party?\n" +
[M_TEXT.name]: "What should we order for the party?\n" +
"1. Pizza\n2. Poutine\n3. Italian\n4. Wings",
};
}
@ -1050,7 +1062,8 @@ function badResponseEvent(): MatrixEvent {
return new MatrixEvent(
{
"event_id": nextId(),
"type": POLL_RESPONSE_EVENT_TYPE.name,
"type": M_POLL_RESPONSE.name,
"sender": "@malicious:example.com",
"content": {
"m.relates_to": {
"rel_type": "m.reference",
@ -1073,14 +1086,14 @@ function responseEvent(
"event_id": nextId(),
"room_id": "#myroom:example.com",
"origin_server_ts": ts,
"type": POLL_RESPONSE_EVENT_TYPE.name,
"type": M_POLL_RESPONSE.name,
"sender": sender,
"content": {
"m.relates_to": {
"rel_type": "m.reference",
"event_id": "$mypoll",
},
[POLL_RESPONSE_EVENT_TYPE.name]: {
[M_POLL_RESPONSE.name]: {
"answers": ans,
},
},
@ -1091,7 +1104,7 @@ function responseEvent(
function expectedResponseEvent(answer: string) {
return {
"content": {
[POLL_RESPONSE_EVENT_TYPE.name]: {
[M_POLL_RESPONSE.name]: {
"answers": [answer],
},
"m.relates_to": {
@ -1099,7 +1112,7 @@ function expectedResponseEvent(answer: string) {
"rel_type": "m.reference",
},
},
"eventType": POLL_RESPONSE_EVENT_TYPE.name,
"eventType": M_POLL_RESPONSE.name,
"roomId": "#myroom:example.com",
"txnId": undefined,
"callback": undefined,
@ -1115,15 +1128,15 @@ function endEvent(
"event_id": nextId(),
"room_id": "#myroom:example.com",
"origin_server_ts": ts,
"type": POLL_END_EVENT_TYPE.name,
"type": M_POLL_END.name,
"sender": sender,
"content": {
"m.relates_to": {
"rel_type": "m.reference",
"event_id": "$mypoll",
},
[POLL_END_EVENT_TYPE.name]: {},
[TEXT_NODE_TYPE.name]: "The poll has ended. Something.",
[M_POLL_END.name]: {},
[M_TEXT.name]: "The poll has ended. Something.",
},
},
);
@ -1133,6 +1146,7 @@ function runIsPollEnded(ends: MatrixEvent[]) {
const pollEvent = new MatrixEvent({
"event_id": "$mypoll",
"room_id": "#myroom:example.com",
"type": M_POLL_START.name,
"content": newPollStart(),
});
@ -1143,7 +1157,7 @@ function runIsPollEnded(ends: MatrixEvent[]) {
(eventId: string, relationType: string, eventType: string) => {
expect(eventId).toBe("$mypoll");
expect(relationType).toBe("m.reference");
expect(eventType).toBe(POLL_END_EVENT_TYPE.name);
expect(M_POLL_END.matches(eventType)).toBe(true);
return newEndRelations(ends);
};
@ -1154,6 +1168,7 @@ function runFindTopAnswer(votes: MatrixEvent[], ends: MatrixEvent[]) {
const pollEvent = new MatrixEvent({
"event_id": "$mypoll",
"room_id": "#myroom:example.com",
"type": M_POLL_START.name,
"content": newPollStart(),
});
@ -1161,9 +1176,9 @@ function runFindTopAnswer(votes: MatrixEvent[], ends: MatrixEvent[]) {
(eventId: string, relationType: string, eventType: string) => {
expect(eventId).toBe("$mypoll");
expect(relationType).toBe("m.reference");
if (POLL_RESPONSE_EVENT_TYPE.matches(eventType)) {
if (M_POLL_RESPONSE.matches(eventType)) {
return newVoteRelations(votes);
} else if (POLL_END_EVENT_TYPE.matches(eventType)) {
} else if (M_POLL_END.matches(eventType)) {
return newEndRelations(ends);
} else {
fail(`eventType should be end or vote but was ${eventType}`);

View file

@ -38,6 +38,7 @@ exports[`MPollBody renders a finished poll 1`] = `
},
"event_id": "$mypoll",
"room_id": "#myroom:example.com",
"type": "org.matrix.msc3381.poll.start",
}
}
>
@ -78,6 +79,7 @@ exports[`MPollBody renders a finished poll 1`] = `
},
"event_id": "$mypoll",
"room_id": "#myroom:example.com",
"type": "org.matrix.msc3381.poll.start",
}
}
>
@ -97,9 +99,23 @@ exports[`MPollBody renders a finished poll 1`] = `
>
<EndedPollOption
answer={
Object {
PollAnswerSubevent {
"html": undefined,
"id": "pizza",
"org.matrix.msc1767.text": "Pizza",
"renderings": Array [
Object {
"body": "Pizza",
"mimetype": "text/plain",
},
],
"text": "Pizza",
"wireFormat": Object {
"content": Object {
"id": "pizza",
"org.matrix.msc1767.text": "Pizza",
},
"type": "org.matrix.sdk.poll.answer",
},
}
}
checked={false}
@ -145,9 +161,23 @@ exports[`MPollBody renders a finished poll 1`] = `
>
<EndedPollOption
answer={
Object {
PollAnswerSubevent {
"html": undefined,
"id": "poutine",
"org.matrix.msc1767.text": "Poutine",
"renderings": Array [
Object {
"body": "Poutine",
"mimetype": "text/plain",
},
],
"text": "Poutine",
"wireFormat": Object {
"content": Object {
"id": "poutine",
"org.matrix.msc1767.text": "Poutine",
},
"type": "org.matrix.sdk.poll.answer",
},
}
}
checked={false}
@ -193,9 +223,23 @@ exports[`MPollBody renders a finished poll 1`] = `
>
<EndedPollOption
answer={
Object {
PollAnswerSubevent {
"html": undefined,
"id": "italian",
"org.matrix.msc1767.text": "Italian",
"renderings": Array [
Object {
"body": "Italian",
"mimetype": "text/plain",
},
],
"text": "Italian",
"wireFormat": Object {
"content": Object {
"id": "italian",
"org.matrix.msc1767.text": "Italian",
},
"type": "org.matrix.sdk.poll.answer",
},
}
}
checked={true}
@ -241,9 +285,23 @@ exports[`MPollBody renders a finished poll 1`] = `
>
<EndedPollOption
answer={
Object {
PollAnswerSubevent {
"html": undefined,
"id": "wings",
"org.matrix.msc1767.text": "Wings",
"renderings": Array [
Object {
"body": "Wings",
"mimetype": "text/plain",
},
],
"text": "Wings",
"wireFormat": Object {
"content": Object {
"id": "wings",
"org.matrix.msc1767.text": "Wings",
},
"type": "org.matrix.sdk.poll.answer",
},
}
}
checked={false}
@ -331,6 +389,7 @@ exports[`MPollBody renders a finished poll with multiple winners 1`] = `
},
"event_id": "$mypoll",
"room_id": "#myroom:example.com",
"type": "org.matrix.msc3381.poll.start",
}
}
>
@ -371,6 +430,7 @@ exports[`MPollBody renders a finished poll with multiple winners 1`] = `
},
"event_id": "$mypoll",
"room_id": "#myroom:example.com",
"type": "org.matrix.msc3381.poll.start",
}
}
>
@ -390,9 +450,23 @@ exports[`MPollBody renders a finished poll with multiple winners 1`] = `
>
<EndedPollOption
answer={
Object {
PollAnswerSubevent {
"html": undefined,
"id": "pizza",
"org.matrix.msc1767.text": "Pizza",
"renderings": Array [
Object {
"body": "Pizza",
"mimetype": "text/plain",
},
],
"text": "Pizza",
"wireFormat": Object {
"content": Object {
"id": "pizza",
"org.matrix.msc1767.text": "Pizza",
},
"type": "org.matrix.sdk.poll.answer",
},
}
}
checked={true}
@ -438,9 +512,23 @@ exports[`MPollBody renders a finished poll with multiple winners 1`] = `
>
<EndedPollOption
answer={
Object {
PollAnswerSubevent {
"html": undefined,
"id": "poutine",
"org.matrix.msc1767.text": "Poutine",
"renderings": Array [
Object {
"body": "Poutine",
"mimetype": "text/plain",
},
],
"text": "Poutine",
"wireFormat": Object {
"content": Object {
"id": "poutine",
"org.matrix.msc1767.text": "Poutine",
},
"type": "org.matrix.sdk.poll.answer",
},
}
}
checked={false}
@ -486,9 +574,23 @@ exports[`MPollBody renders a finished poll with multiple winners 1`] = `
>
<EndedPollOption
answer={
Object {
PollAnswerSubevent {
"html": undefined,
"id": "italian",
"org.matrix.msc1767.text": "Italian",
"renderings": Array [
Object {
"body": "Italian",
"mimetype": "text/plain",
},
],
"text": "Italian",
"wireFormat": Object {
"content": Object {
"id": "italian",
"org.matrix.msc1767.text": "Italian",
},
"type": "org.matrix.sdk.poll.answer",
},
}
}
checked={false}
@ -534,9 +636,23 @@ exports[`MPollBody renders a finished poll with multiple winners 1`] = `
>
<EndedPollOption
answer={
Object {
PollAnswerSubevent {
"html": undefined,
"id": "wings",
"org.matrix.msc1767.text": "Wings",
"renderings": Array [
Object {
"body": "Wings",
"mimetype": "text/plain",
},
],
"text": "Wings",
"wireFormat": Object {
"content": Object {
"id": "wings",
"org.matrix.msc1767.text": "Wings",
},
"type": "org.matrix.sdk.poll.answer",
},
}
}
checked={true}
@ -624,6 +740,7 @@ exports[`MPollBody renders a finished poll with no votes 1`] = `
},
"event_id": "$mypoll",
"room_id": "#myroom:example.com",
"type": "org.matrix.msc3381.poll.start",
}
}
>
@ -664,6 +781,7 @@ exports[`MPollBody renders a finished poll with no votes 1`] = `
},
"event_id": "$mypoll",
"room_id": "#myroom:example.com",
"type": "org.matrix.msc3381.poll.start",
}
}
>
@ -683,9 +801,23 @@ exports[`MPollBody renders a finished poll with no votes 1`] = `
>
<EndedPollOption
answer={
Object {
PollAnswerSubevent {
"html": undefined,
"id": "pizza",
"org.matrix.msc1767.text": "Pizza",
"renderings": Array [
Object {
"body": "Pizza",
"mimetype": "text/plain",
},
],
"text": "Pizza",
"wireFormat": Object {
"content": Object {
"id": "pizza",
"org.matrix.msc1767.text": "Pizza",
},
"type": "org.matrix.sdk.poll.answer",
},
}
}
checked={false}
@ -731,9 +863,23 @@ exports[`MPollBody renders a finished poll with no votes 1`] = `
>
<EndedPollOption
answer={
Object {
PollAnswerSubevent {
"html": undefined,
"id": "poutine",
"org.matrix.msc1767.text": "Poutine",
"renderings": Array [
Object {
"body": "Poutine",
"mimetype": "text/plain",
},
],
"text": "Poutine",
"wireFormat": Object {
"content": Object {
"id": "poutine",
"org.matrix.msc1767.text": "Poutine",
},
"type": "org.matrix.sdk.poll.answer",
},
}
}
checked={false}
@ -779,9 +925,23 @@ exports[`MPollBody renders a finished poll with no votes 1`] = `
>
<EndedPollOption
answer={
Object {
PollAnswerSubevent {
"html": undefined,
"id": "italian",
"org.matrix.msc1767.text": "Italian",
"renderings": Array [
Object {
"body": "Italian",
"mimetype": "text/plain",
},
],
"text": "Italian",
"wireFormat": Object {
"content": Object {
"id": "italian",
"org.matrix.msc1767.text": "Italian",
},
"type": "org.matrix.sdk.poll.answer",
},
}
}
checked={false}
@ -827,9 +987,23 @@ exports[`MPollBody renders a finished poll with no votes 1`] = `
>
<EndedPollOption
answer={
Object {
PollAnswerSubevent {
"html": undefined,
"id": "wings",
"org.matrix.msc1767.text": "Wings",
"renderings": Array [
Object {
"body": "Wings",
"mimetype": "text/plain",
},
],
"text": "Wings",
"wireFormat": Object {
"content": Object {
"id": "wings",
"org.matrix.msc1767.text": "Wings",
},
"type": "org.matrix.sdk.poll.answer",
},
}
}
checked={false}
@ -917,6 +1091,7 @@ exports[`MPollBody renders a poll that I have not voted in 1`] = `
},
"event_id": "$mypoll",
"room_id": "#myroom:example.com",
"type": "org.matrix.msc3381.poll.start",
}
}
>
@ -957,6 +1132,7 @@ exports[`MPollBody renders a poll that I have not voted in 1`] = `
},
"event_id": "$mypoll",
"room_id": "#myroom:example.com",
"type": "org.matrix.msc3381.poll.start",
}
}
>
@ -976,9 +1152,23 @@ exports[`MPollBody renders a poll that I have not voted in 1`] = `
>
<LivePollOption
answer={
Object {
PollAnswerSubevent {
"html": undefined,
"id": "pizza",
"org.matrix.msc1767.text": "Pizza",
"renderings": Array [
Object {
"body": "Pizza",
"mimetype": "text/plain",
},
],
"text": "Pizza",
"wireFormat": Object {
"content": Object {
"id": "pizza",
"org.matrix.msc1767.text": "Pizza",
},
"type": "org.matrix.sdk.poll.answer",
},
}
}
checked={false}
@ -1049,9 +1239,23 @@ exports[`MPollBody renders a poll that I have not voted in 1`] = `
>
<LivePollOption
answer={
Object {
PollAnswerSubevent {
"html": undefined,
"id": "poutine",
"org.matrix.msc1767.text": "Poutine",
"renderings": Array [
Object {
"body": "Poutine",
"mimetype": "text/plain",
},
],
"text": "Poutine",
"wireFormat": Object {
"content": Object {
"id": "poutine",
"org.matrix.msc1767.text": "Poutine",
},
"type": "org.matrix.sdk.poll.answer",
},
}
}
checked={false}
@ -1122,9 +1326,23 @@ exports[`MPollBody renders a poll that I have not voted in 1`] = `
>
<LivePollOption
answer={
Object {
PollAnswerSubevent {
"html": undefined,
"id": "italian",
"org.matrix.msc1767.text": "Italian",
"renderings": Array [
Object {
"body": "Italian",
"mimetype": "text/plain",
},
],
"text": "Italian",
"wireFormat": Object {
"content": Object {
"id": "italian",
"org.matrix.msc1767.text": "Italian",
},
"type": "org.matrix.sdk.poll.answer",
},
}
}
checked={false}
@ -1195,9 +1413,23 @@ exports[`MPollBody renders a poll that I have not voted in 1`] = `
>
<LivePollOption
answer={
Object {
PollAnswerSubevent {
"html": undefined,
"id": "wings",
"org.matrix.msc1767.text": "Wings",
"renderings": Array [
Object {
"body": "Wings",
"mimetype": "text/plain",
},
],
"text": "Wings",
"wireFormat": Object {
"content": Object {
"id": "wings",
"org.matrix.msc1767.text": "Wings",
},
"type": "org.matrix.sdk.poll.answer",
},
}
}
checked={false}
@ -1310,6 +1542,7 @@ exports[`MPollBody renders a poll with local, non-local and invalid votes 1`] =
},
"event_id": "$mypoll",
"room_id": "#myroom:example.com",
"type": "org.matrix.msc3381.poll.start",
}
}
>
@ -1350,6 +1583,7 @@ exports[`MPollBody renders a poll with local, non-local and invalid votes 1`] =
},
"event_id": "$mypoll",
"room_id": "#myroom:example.com",
"type": "org.matrix.msc3381.poll.start",
}
}
>
@ -1369,9 +1603,23 @@ exports[`MPollBody renders a poll with local, non-local and invalid votes 1`] =
>
<LivePollOption
answer={
Object {
PollAnswerSubevent {
"html": undefined,
"id": "pizza",
"org.matrix.msc1767.text": "Pizza",
"renderings": Array [
Object {
"body": "Pizza",
"mimetype": "text/plain",
},
],
"text": "Pizza",
"wireFormat": Object {
"content": Object {
"id": "pizza",
"org.matrix.msc1767.text": "Pizza",
},
"type": "org.matrix.sdk.poll.answer",
},
}
}
checked={false}
@ -1444,9 +1692,23 @@ exports[`MPollBody renders a poll with local, non-local and invalid votes 1`] =
>
<LivePollOption
answer={
Object {
PollAnswerSubevent {
"html": undefined,
"id": "poutine",
"org.matrix.msc1767.text": "Poutine",
"renderings": Array [
Object {
"body": "Poutine",
"mimetype": "text/plain",
},
],
"text": "Poutine",
"wireFormat": Object {
"content": Object {
"id": "poutine",
"org.matrix.msc1767.text": "Poutine",
},
"type": "org.matrix.sdk.poll.answer",
},
}
}
checked={false}
@ -1519,9 +1781,23 @@ exports[`MPollBody renders a poll with local, non-local and invalid votes 1`] =
>
<LivePollOption
answer={
Object {
PollAnswerSubevent {
"html": undefined,
"id": "italian",
"org.matrix.msc1767.text": "Italian",
"renderings": Array [
Object {
"body": "Italian",
"mimetype": "text/plain",
},
],
"text": "Italian",
"wireFormat": Object {
"content": Object {
"id": "italian",
"org.matrix.msc1767.text": "Italian",
},
"type": "org.matrix.sdk.poll.answer",
},
}
}
checked={true}
@ -1594,9 +1870,23 @@ exports[`MPollBody renders a poll with local, non-local and invalid votes 1`] =
>
<LivePollOption
answer={
Object {
PollAnswerSubevent {
"html": undefined,
"id": "wings",
"org.matrix.msc1767.text": "Wings",
"renderings": Array [
Object {
"body": "Wings",
"mimetype": "text/plain",
},
],
"text": "Wings",
"wireFormat": Object {
"content": Object {
"id": "wings",
"org.matrix.msc1767.text": "Wings",
},
"type": "org.matrix.sdk.poll.answer",
},
}
}
checked={false}
@ -1711,6 +2001,7 @@ exports[`MPollBody renders a poll with no votes 1`] = `
},
"event_id": "$mypoll",
"room_id": "#myroom:example.com",
"type": "org.matrix.msc3381.poll.start",
}
}
>
@ -1751,6 +2042,7 @@ exports[`MPollBody renders a poll with no votes 1`] = `
},
"event_id": "$mypoll",
"room_id": "#myroom:example.com",
"type": "org.matrix.msc3381.poll.start",
}
}
>
@ -1770,9 +2062,23 @@ exports[`MPollBody renders a poll with no votes 1`] = `
>
<LivePollOption
answer={
Object {
PollAnswerSubevent {
"html": undefined,
"id": "pizza",
"org.matrix.msc1767.text": "Pizza",
"renderings": Array [
Object {
"body": "Pizza",
"mimetype": "text/plain",
},
],
"text": "Pizza",
"wireFormat": Object {
"content": Object {
"id": "pizza",
"org.matrix.msc1767.text": "Pizza",
},
"type": "org.matrix.sdk.poll.answer",
},
}
}
checked={false}
@ -1843,9 +2149,23 @@ exports[`MPollBody renders a poll with no votes 1`] = `
>
<LivePollOption
answer={
Object {
PollAnswerSubevent {
"html": undefined,
"id": "poutine",
"org.matrix.msc1767.text": "Poutine",
"renderings": Array [
Object {
"body": "Poutine",
"mimetype": "text/plain",
},
],
"text": "Poutine",
"wireFormat": Object {
"content": Object {
"id": "poutine",
"org.matrix.msc1767.text": "Poutine",
},
"type": "org.matrix.sdk.poll.answer",
},
}
}
checked={false}
@ -1916,9 +2236,23 @@ exports[`MPollBody renders a poll with no votes 1`] = `
>
<LivePollOption
answer={
Object {
PollAnswerSubevent {
"html": undefined,
"id": "italian",
"org.matrix.msc1767.text": "Italian",
"renderings": Array [
Object {
"body": "Italian",
"mimetype": "text/plain",
},
],
"text": "Italian",
"wireFormat": Object {
"content": Object {
"id": "italian",
"org.matrix.msc1767.text": "Italian",
},
"type": "org.matrix.sdk.poll.answer",
},
}
}
checked={false}
@ -1989,9 +2323,23 @@ exports[`MPollBody renders a poll with no votes 1`] = `
>
<LivePollOption
answer={
Object {
PollAnswerSubevent {
"html": undefined,
"id": "wings",
"org.matrix.msc1767.text": "Wings",
"renderings": Array [
Object {
"body": "Wings",
"mimetype": "text/plain",
},
],
"text": "Wings",
"wireFormat": Object {
"content": Object {
"id": "wings",
"org.matrix.msc1767.text": "Wings",
},
"type": "org.matrix.sdk.poll.answer",
},
}
}
checked={false}
@ -2104,6 +2452,7 @@ exports[`MPollBody renders a poll with only non-local votes 1`] = `
},
"event_id": "$mypoll",
"room_id": "#myroom:example.com",
"type": "org.matrix.msc3381.poll.start",
}
}
>
@ -2144,6 +2493,7 @@ exports[`MPollBody renders a poll with only non-local votes 1`] = `
},
"event_id": "$mypoll",
"room_id": "#myroom:example.com",
"type": "org.matrix.msc3381.poll.start",
}
}
>
@ -2163,9 +2513,23 @@ exports[`MPollBody renders a poll with only non-local votes 1`] = `
>
<LivePollOption
answer={
Object {
PollAnswerSubevent {
"html": undefined,
"id": "pizza",
"org.matrix.msc1767.text": "Pizza",
"renderings": Array [
Object {
"body": "Pizza",
"mimetype": "text/plain",
},
],
"text": "Pizza",
"wireFormat": Object {
"content": Object {
"id": "pizza",
"org.matrix.msc1767.text": "Pizza",
},
"type": "org.matrix.sdk.poll.answer",
},
}
}
checked={false}
@ -2238,9 +2602,23 @@ exports[`MPollBody renders a poll with only non-local votes 1`] = `
>
<LivePollOption
answer={
Object {
PollAnswerSubevent {
"html": undefined,
"id": "poutine",
"org.matrix.msc1767.text": "Poutine",
"renderings": Array [
Object {
"body": "Poutine",
"mimetype": "text/plain",
},
],
"text": "Poutine",
"wireFormat": Object {
"content": Object {
"id": "poutine",
"org.matrix.msc1767.text": "Poutine",
},
"type": "org.matrix.sdk.poll.answer",
},
}
}
checked={false}
@ -2313,9 +2691,23 @@ exports[`MPollBody renders a poll with only non-local votes 1`] = `
>
<LivePollOption
answer={
Object {
PollAnswerSubevent {
"html": undefined,
"id": "italian",
"org.matrix.msc1767.text": "Italian",
"renderings": Array [
Object {
"body": "Italian",
"mimetype": "text/plain",
},
],
"text": "Italian",
"wireFormat": Object {
"content": Object {
"id": "italian",
"org.matrix.msc1767.text": "Italian",
},
"type": "org.matrix.sdk.poll.answer",
},
}
}
checked={false}
@ -2388,9 +2780,23 @@ exports[`MPollBody renders a poll with only non-local votes 1`] = `
>
<LivePollOption
answer={
Object {
PollAnswerSubevent {
"html": undefined,
"id": "wings",
"org.matrix.msc1767.text": "Wings",
"renderings": Array [
Object {
"body": "Wings",
"mimetype": "text/plain",
},
],
"text": "Wings",
"wireFormat": Object {
"content": Object {
"id": "wings",
"org.matrix.msc1767.text": "Wings",
},
"type": "org.matrix.sdk.poll.answer",
},
}
}
checked={true}