Refactor PollHandler to make it more reliable. This ended up with much more code than I expected as the original intent was just to stop a crash when switching rooms. - Using a event string was flaky, changing to using an event reference is more reliable. - Since we're only creating them from NeoChatRoom there is no need to to be able to set properties from QML so only read properties. - Pass from the MessageEventModel rather than an invokable method. - Create a basic test suite - Create properties in PollHandler to remove the need to use content in PollDelegate, this means content is no longer a required role.
39 lines
1.1 KiB
JSON
39 lines
1.1 KiB
JSON
{
|
|
"timeline": {
|
|
"events": [
|
|
{
|
|
"content": {
|
|
"org.matrix.msc1767.text": "test\n1. option1\n2. option 2",
|
|
"org.matrix.msc3381.poll.start": {
|
|
"answers": [
|
|
{
|
|
"id": "option1",
|
|
"org.matrix.msc1767.text": "option1"
|
|
},
|
|
{
|
|
"id": "option2",
|
|
"org.matrix.msc1767.text": "option2"
|
|
}
|
|
],
|
|
"kind": "org.matrix.msc3381.poll.disclosed",
|
|
"max_selections": 1,
|
|
"question": {
|
|
"body": "test",
|
|
"msgtype": "m.text",
|
|
"org.matrix.msc1767.text": "test"
|
|
}
|
|
}
|
|
},
|
|
"event_id": "$153456789:example.org",
|
|
"origin_server_ts": 1432735824654,
|
|
"room_id": "!jEsUZKDJdhlrceRyVU:example.org",
|
|
"sender": "@example:example.org",
|
|
"type": "org.matrix.msc3381.poll.start",
|
|
"unsigned": {
|
|
"age": 1232
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|