Poll history - read only list of polls in current timeline (#10055)

* add settings while under development

* very basic tests for roomsummarycard

* empty poll history dialog and option in room summary

* pollS history in settings

* render an ugly list of polls in current timeline

* readonly poll history list items

* fix scroll window

* use short year code in date format, tidy

* no results message + tests

* strict fix

* mock intldatetimeformat for stable date formatting

* extract date format fn into date-utils

* jsdoc
This commit is contained in:
Kerry 2023-02-03 10:39:23 +13:00 committed by GitHub
parent 544baa30ed
commit ebb8408f28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 572 additions and 7 deletions

View file

@ -18,7 +18,13 @@ import { MatrixEvent } from "matrix-js-sdk/src/matrix";
import { M_POLL_START, PollAnswer, M_POLL_KIND_DISCLOSED } from "matrix-js-sdk/src/@types/polls";
import { M_TEXT } from "matrix-js-sdk/src/@types/extensible_events";
export const makePollStartEvent = (question: string, sender: string, answers?: PollAnswer[]): MatrixEvent => {
export const makePollStartEvent = (
question: string,
sender: string,
answers?: PollAnswer[],
ts?: number,
id?: string,
): MatrixEvent => {
if (!answers) {
answers = [
{ id: "socks", [M_TEXT.name]: "Socks" },
@ -27,7 +33,7 @@ export const makePollStartEvent = (question: string, sender: string, answers?: P
}
return new MatrixEvent({
event_id: "$mypoll",
event_id: id || "$mypoll",
room_id: "#myroom:example.com",
sender: sender,
type: M_POLL_START.name,
@ -41,5 +47,6 @@ export const makePollStartEvent = (question: string, sender: string, answers?: P
},
[M_TEXT.name]: `${question}: answers`,
},
origin_server_ts: ts || 0,
});
};