From bc5f247fcfb4a6dd12a190a703c44a9d36bb4158 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Mon, 23 Mar 2015 12:49:54 +0800 Subject: Bug 1141165: Enforce mandatory field on form.reps.mentorship --- extensions/REMO/Extension.pm | 5 ++++- .../REMO/template/en/default/hook/global/user-error-errors.html.tmpl | 4 ++++ extensions/REMO/web/js/moz_reps.js | 5 +++-- 3 files changed, 11 insertions(+), 3 deletions(-) (limited to 'extensions/REMO') diff --git a/extensions/REMO/Extension.pm b/extensions/REMO/Extension.pm index 1e99182e0..9f83f7065 100644 --- a/extensions/REMO/Extension.pm +++ b/extensions/REMO/Extension.pm @@ -318,11 +318,14 @@ sub post_bug_after_creation { status => '?', requestee => $_->login } } @cc_users; + ThrowUserError('remo_missing_voucher') unless @cc_users; $bug->set_flags(\@new_flags, []) if @new_flags; $bug->add_comment( join(", ", map { $_->name || $_->login } @cc_users) . - ": You have been added as supporter to this Reps application, please comment why do you endorse their application. Thanks!" + ": You have been added as a voucher to this Reps application.\n" . + "Please provide a comment describing why you endorse this application.\n" . + "Thanks!" ); $bug->update($bug->creation_ts); diff --git a/extensions/REMO/template/en/default/hook/global/user-error-errors.html.tmpl b/extensions/REMO/template/en/default/hook/global/user-error-errors.html.tmpl index 200e678be..e13fba024 100644 --- a/extensions/REMO/template/en/default/hook/global/user-error-errors.html.tmpl +++ b/extensions/REMO/template/en/default/hook/global/user-error-errors.html.tmpl @@ -37,4 +37,8 @@ You can either create a new payment request or [% "go back to $terms.bug $bugid" FILTER bug_link(bugid) FILTER none %]. +[% ELSIF error == "remo_missing_voucher" %] + [% title = "Missing Vouchers" %] + You did not provide anyone to vouch for your application. + [% END %] diff --git a/extensions/REMO/web/js/moz_reps.js b/extensions/REMO/web/js/moz_reps.js index 88c60df51..e269e4445 100644 --- a/extensions/REMO/web/js/moz_reps.js +++ b/extensions/REMO/web/js/moz_reps.js @@ -49,9 +49,10 @@ $(document).ready(function() { $('label.required').each(function (index) { var id = $(this).attr("for"); var input = $("#" + id); + var value = input.val().trim(); if (id == 'mozillian') { - if (!input.val().match(mozillian_re)) { + if (!value.match(mozillian_re)) { input.addClass("missing"); errors.push("The Mozillian Account URL is invalid"); event.preventDefault(); @@ -61,7 +62,7 @@ $(document).ready(function() { } } else { - if (input.val() == "") { + if (value == "") { input.addClass("missing"); missing = true; event.preventDefault(); -- cgit v1.2.3-24-g4f1b