Niharika29 has uploaded a new change for review. https://gerrit.wikimedia.org/r/195852
Change subject: [WIP] Make only one question mandatory at campaign start page ...................................................................... [WIP] Make only one question mandatory at campaign start page Change-Id: Ia00d2e4bfbf47f0918077dfd8c1990972a0c106d --- M data/i18n/en.json M data/i18n/qqq.json M src/Controllers/Admin/Campaign.php 3 files changed, 7 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/wikimedia/iegreview refs/changes/52/195852/1 diff --git a/data/i18n/en.json b/data/i18n/en.json index 8c51511..2098b22 100644 --- a/data/i18n/en.json +++ b/data/i18n/en.json @@ -112,6 +112,7 @@ "admin-campaign-reviewers": "Campaign reviewers:", "admin-campaign-question": "Question $1:", "admin-campaign-question-placeholder": "Add question text here", + "admin-campaign-one-question-minimum": "At least one question string is required", "page-of-pages": "Page $1 of $2", "no-results": "No results found", diff --git a/data/i18n/qqq.json b/data/i18n/qqq.json index 2026de5..ee82b54 100644 --- a/data/i18n/qqq.json +++ b/data/i18n/qqq.json @@ -48,6 +48,7 @@ "admin-campaign-reviewers": "Input label, followed by a checkbox group", "admin-campaign-question": "Input label, followed by multi-line textarea. Parameters:\n* $1 - question number", "admin-campaign-question-placeholder": "Placeholder text for a textarea", + "admin-campaign-one-question-minimum": "Message shown to user when they have left all question fields empty", "change-password": "Navigation menu item, links to password change page.\n{{Identical|Change password}}", "credits": "Credits page heading", diff --git a/src/Controllers/Admin/Campaign.php b/src/Controllers/Admin/Campaign.php index c325d87..4f4d6ed 100644 --- a/src/Controllers/Admin/Campaign.php +++ b/src/Controllers/Admin/Campaign.php @@ -84,7 +84,7 @@ $this->form->requireString( 'end_date' ); $this->form->expectIntArray( 'reviewer' ); - $this->form->requireStringArray( 'questions' ); + $this->form->expectStringArray( 'questions' ); if ( $this->form->validate() ) { $params = array( @@ -99,6 +99,10 @@ $this->flash( 'error', $this->i18nContext->message( 'admin-new-campaign-in-progress' ) ); + } elseif ( count( $questions ) < 1 ) { + $this->flash( 'error', + $this->i18nContext->message( 'admin-campaign-one-question-minimum' ) + ); } elseif ( $id == 'new' ) { // This is a temporary fix to make the *just started* campaign // active and bypass the actual start and end date to be fixed -- To view, visit https://gerrit.wikimedia.org/r/195852 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia00d2e4bfbf47f0918077dfd8c1990972a0c106d Gerrit-PatchSet: 1 Gerrit-Project: wikimedia/iegreview Gerrit-Branch: master Gerrit-Owner: Niharika29 <niharikakohl...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits