Page MenuHomePhabricator

Convert SecurePoll VotePage to use OOUI
Closed, ResolvedPublic3 Estimated Story Points


This page uses includes from Ballot classes to generate a form in raw HTML:

			"<form name=\"securepoll\" id=\"securepoll\" method=\"post\" action=\"$encAction\">\n" .
			$this->election->getBallot()->getForm( $status ) .
			"<br />\n" .
			"<input name=\"submit\" type=\"submit\" value=\"$encOK\">\n" .
			"<input type='hidden' name='edit_token' value=\"{$encToken}\" /></td>\n" .

After all the includes have been converted to use OOUI, this page and Ballot.php (which is a wrapper around the returned fields) should also be updated to finish out the conversion.

  • includes/Ballots/Ballot.php
  • includes/Ballots/ApprovalBallot.php
  • includes/Ballots/ChooseBallot.php
  • includes/Ballots/PreferentialBallot.php
  • includes/Ballots/RadioRangeBallot.php
  • includes/Ballots/RadioRangeCommentBallot.php

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change 676132 had a related patch set uploaded (by Wikitrent; author: Wikitrent):

[mediawiki/extensions/SecurePoll@master] Convert SecurePoll VotePage to OOUI

Change 676132 merged by jenkins-bot:

[mediawiki/extensions/SecurePoll@master] Convert SecurePoll VotePage to OOUI

Change 677639 had a related patch set uploaded (by Tchanders; author: Tchanders):

[mediawiki/extensions/SecurePoll@master] Wrap VotePage error message in HTMLSnippet

The new patch fixes a bug that appears when the vote page is submitted with an error:

image.png (414×619 px, 38 KB)

We're outputting escaped HTML as a result of the error being built as a string and passed to OOUI\Element as text content:

// In class Ballot

public function getForm( $prevStatus = false ) {
    // ...
    $formStatus = new \OOUI\Element( [
        'content' => $this->formatStatus( $prevStatus ),
    ] );
    // ...

public function formatStatus( $status ) {
    return $status->sp_getHTML( $this->usedErrorIds );
// In class BallotStatus

public function sp_getHTML( $usedIds ) {
	// ...
	$s = '<ul class="securepoll-error-box">';
	// Then more HTML string building...
	$s .= "</ul>\n";

	return $s;

A quick fix is to wrap it in an HTMLSnippet in Ballot::getForm. A better long-term fix would be to use an error message widget for the error: T279570

Change 677639 merged by jenkins-bot:

[mediawiki/extensions/SecurePoll@master] Wrap VotePage error message in HTMLSnippet

dom_walden subscribed.

I tested a few different types of election, including Range voting (plurality) with comment and Range voting (histogram range) with comment.

I could submit a vote and it was recorded correctly in the database.

I tested with and without javascript.

I tested the validation error messages. They mostly have not changed, apart from Range votes as shown below.


range_validation_before.png (601×893 px, 67 KB)


range_validation_after.png (649×880 px, 76 KB)

Test Environment: SecurePoll 2.0.0 (bd806ca) 07:21, 13 April 2021.
Test browser: Firefox 78