Apply prettier formatting
This commit is contained in:
parent
1cac306093
commit
526645c791
1576 changed files with 65385 additions and 62478 deletions
|
@ -36,34 +36,25 @@ interface IProps extends IDialogProps {
|
|||
|
||||
export default class EndPollDialog extends React.Component<IProps> {
|
||||
private onFinished = (endPoll: boolean) => {
|
||||
const topAnswer = findTopAnswer(
|
||||
this.props.event,
|
||||
this.props.matrixClient,
|
||||
this.props.getRelationsForEvent,
|
||||
);
|
||||
const topAnswer = findTopAnswer(this.props.event, this.props.matrixClient, this.props.getRelationsForEvent);
|
||||
|
||||
const message = (
|
||||
(topAnswer === "")
|
||||
const message =
|
||||
topAnswer === ""
|
||||
? _t("The poll has ended. No votes were cast.")
|
||||
: _t(
|
||||
"The poll has ended. Top answer: %(topAnswer)s",
|
||||
{ topAnswer },
|
||||
)
|
||||
);
|
||||
: _t("The poll has ended. Top answer: %(topAnswer)s", { topAnswer });
|
||||
|
||||
if (endPoll) {
|
||||
const endEvent = PollEndEvent.from(this.props.event.getId(), message).serialize();
|
||||
|
||||
this.props.matrixClient.sendEvent(
|
||||
this.props.event.getRoomId(), endEvent.type, endEvent.content,
|
||||
).catch((e: any) => {
|
||||
console.error("Failed to submit poll response event:", e);
|
||||
Modal.createDialog(ErrorDialog, {
|
||||
title: _t("Failed to end poll"),
|
||||
description: _t(
|
||||
"Sorry, the poll did not end. Please try again."),
|
||||
this.props.matrixClient
|
||||
.sendEvent(this.props.event.getRoomId(), endEvent.type, endEvent.content)
|
||||
.catch((e: any) => {
|
||||
console.error("Failed to submit poll response event:", e);
|
||||
Modal.createDialog(ErrorDialog, {
|
||||
title: _t("Failed to end poll"),
|
||||
description: _t("Sorry, the poll did not end. Please try again."),
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
this.props.onFinished(endPoll);
|
||||
};
|
||||
|
@ -72,13 +63,11 @@ export default class EndPollDialog extends React.Component<IProps> {
|
|||
return (
|
||||
<QuestionDialog
|
||||
title={_t("End Poll")}
|
||||
description={
|
||||
_t(
|
||||
"Are you sure you want to end this poll? " +
|
||||
description={_t(
|
||||
"Are you sure you want to end this poll? " +
|
||||
"This will show the final results of the poll and " +
|
||||
"stop people from being able to vote.",
|
||||
)
|
||||
}
|
||||
)}
|
||||
button={_t("End Poll")}
|
||||
onFinished={(endPoll: boolean) => this.onFinished(endPoll)}
|
||||
/>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue