You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-30 02:21:17 +03:00
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:
@ -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,
|
||||
});
|
||||
};
|
||||
|
Reference in New Issue
Block a user