jenkins-bot has submitted this change and it was merged. Change subject: Do not show extra form if it does not contain any visible inputs ......................................................................
Do not show extra form if it does not contain any visible inputs Change-Id: Ieece34b310fb41c68c37c57a2ca6ad7837a660f6 --- M includes/specials/SpecialEnroll.php 1 file changed, 8 insertions(+), 4 deletions(-) Approvals: Reedy: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/specials/SpecialEnroll.php b/includes/specials/SpecialEnroll.php index b647e83..23ee802 100644 --- a/includes/specials/SpecialEnroll.php +++ b/includes/specials/SpecialEnroll.php @@ -119,12 +119,14 @@ $user = $this->getUser(); $hasFields = trim( $user->getRealName() ) !== '' && $user->getOption( 'gender' ) !== 'unknown'; - if ( $hasFields ) { + $formFields = $this->getFormFields(); + + if ( $hasFields || count( $formFields ) < 3 ) { $this->doEnroll( $course ); $this->onSuccess(); } else { - $this->showEnrollmentForm(); + $this->showEnrollmentForm( $formFields ); } } else { @@ -264,11 +266,13 @@ * Create and display the enrollment form. * * @since 0.1 + * + * @param array $formFields */ - protected function showEnrollmentForm() { + protected function showEnrollmentForm( array $formFields ) { $this->getOutput()->addWikiMsg( 'ep-enroll-header' ); - $form = new \HTMLForm( $this->getFormFields(), $this->getContext() ); + $form = new \HTMLForm( $formFields, $this->getContext() ); $form->setSubmitCallback( array( $this, 'handleSubmission' ) ); $form->setSubmitText( $this->msg( 'educationprogram-org-submit' )->text() ); -- To view, visit https://gerrit.wikimedia.org/r/45956 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ieece34b310fb41c68c37c57a2ca6ad7837a660f6 Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/extensions/EducationProgram Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw <jeroended...@gmail.com> Gerrit-Reviewer: CSteipp <cste...@wikimedia.org> Gerrit-Reviewer: Ragesoss <rages...@gmail.com> Gerrit-Reviewer: Reedy <re...@wikimedia.org> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits