This is an automated email from the ASF dual-hosted git repository. curcuru pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/whimsy.git
commit e5506ce27969a89cc1e3fe3ab1fa79abf04f4844 Author: Shane Curcuru <[email protected]> AuthorDate: Wed Jan 29 07:34:35 2025 -0500 Guard against blank nominations; cleanup text --- www/members/nominate_board.cgi | 13 +++++++------ www/members/nominate_member.cgi | 9 +++++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/www/members/nominate_board.cgi b/www/members/nominate_board.cgi index 4f45fe33..bd69352f 100755 --- a/www/members/nominate_board.cgi +++ b/www/members/nominate_board.cgi @@ -6,14 +6,13 @@ require 'wunderbar' require 'wunderbar/bootstrap' require 'whimsy/asf' require 'whimsy/asf/forms' -require 'whimsy/asf/member-files' +require 'whimsy/asf/member-files' # See for nomination file parsing require 'whimsy/asf/wunderbar_updates' require 'whimsy/asf/meeting-util' require 'whimsy/asf/time-utils' require 'mail' MAILING_LIST = '[email protected]' -NOMINATION_FILE = 'board_nominations.txt' def emit_form(title, prev_data) _whimsy_panel(title, style: 'panel-success') do @@ -40,7 +39,7 @@ def emit_form(title, prev_data) multiple: false, values: prev_data[field], options: field_list, - helptext: 'Select the name of the Member to nominate for Board election' + helptext: 'Select the name of a Member to nominate for the Board election' ) _whimsy_forms_input( label: 'Nominated by', name: 'nomby', readonly: true, value: $USER @@ -61,8 +60,9 @@ end # Returns: 'OK' or a text message describing the problem def validate_form(formdata: {}) uid = formdata['availid'] + return "You MUST provide a nomination statement for Candidate #{uid}; blank was provided!" if formdata['statement'].empty? chk = ASF::Person[uid]&.asf_member? - chk.nil? and return "Invalid availid or non-Member suppiled: (#{uid})\n\nStatement:\n#{formdata['statement']}" + chk.nil? and return "Invalid availid or non-Member nominated; please add manually if desired: (#{uid})\n\nYour Statement:\n#{formdata['statement']}" already = ASF::MemberFiles.board_nominees return "Candidate #{uid} has already been nominated by #{already[uid]['Nominated by']}" if already.include? uid return 'OK' @@ -71,7 +71,7 @@ end # Handle submission (checkout board_nominations.txt, write form data, checkin file) # @return true if we think it succeeded; false in all other cases def process_form(formdata: {}, wunderbar: {}) - _h3 "Transcript of update to nomination file #{NOMINATION_FILE}" + _h3 "Transcript of update to nomination file #{ASF::MemberFiles::NOMINATED_BOARD}" entry = ASF::MemberFiles.make_board_nomination({ availid: formdata['availid'], nomby: formdata['nomby'], @@ -105,6 +105,7 @@ Nominee has been added: Email generated by Whimsy (#{File.basename(__FILE__)}) MAILBODY +# See check_boardnoms.cgi which parses this in list archives mailsubject = "[BOARD NOMINATION] #{ASF::Person.new(uid).public_name} (#{uid})" ASF::Mail.configure @@ -169,7 +170,7 @@ _html do _p do _ %Q{ Use this form to nominate any Member for the ASF Board of Director election. - It automatically adds a properly formatted nomination to the #{NOMINATION_FILE} file, + It automatically adds a properly formatted nomination to the #{ASF::MemberFiles::NOMINATED_BOARD} file, and will then } _strong 'send an email to the members@ list' diff --git a/www/members/nominate_member.cgi b/www/members/nominate_member.cgi index 2c658d12..b6319220 100755 --- a/www/members/nominate_member.cgi +++ b/www/members/nominate_member.cgi @@ -6,14 +6,13 @@ require 'wunderbar' require 'wunderbar/bootstrap' require 'whimsy/asf' require 'whimsy/asf/forms' -require 'whimsy/asf/member-files' +require 'whimsy/asf/member-files' # See for nomination file parsing require 'whimsy/asf/wunderbar_updates' require 'whimsy/asf/meeting-util' require 'whimsy/asf/time-utils' require 'mail' MAILING_LIST = '[email protected]' -NOMINATION_FILE = 'nominated-members.txt' def emit_form(title, prev_data) _whimsy_panel(title, style: 'panel-success') do @@ -40,6 +39,7 @@ end # Returns: 'OK' or a text message describing the problem def validate_form(formdata: {}) uid = formdata['availid'] + return "You MUST provide a nomination statement for Candidate #{uid}; blank was provided!" if formdata['statement'].empty? chk = ASF::Person[uid]&.asf_member? chk.nil? and return "Invalid availid suppiled: (#{uid})\n\nStatement:\n#{formdata['statement']}" # Allow renomination of Emeritus @@ -53,7 +53,7 @@ end # Handle submission (checkout user's apacheid.json, write form data, checkin file) # @return true if we think it succeeded; false in all other cases def process_form(formdata: {}, wunderbar: {}) - _h3 "Transcript of update to nomination file #{NOMINATION_FILE}" + _h3 "Transcript of update to nomination file #{ASF::MemberFiles::NOMINATED_MEMBERS}" entry = ASF::MemberFiles.make_member_nomination({ availid: formdata['availid'], nomby: formdata['nomby'], @@ -87,6 +87,7 @@ Candidate has been added: Email generated by Whimsy (#{File.basename(__FILE__)}) MAILBODY +# See check_membernoms.cgi which parses this in list archives mailsubject = "[MEMBER NOMINATION] #{ASF::Person.new(uid).public_name} (#{uid})" ASF::Mail.configure @@ -153,7 +154,7 @@ _html do _p do _ %Q{ Use this form to nominate any Committer the new ASF Membership election. - It automatically adds a properly formatted nomination to the #{NOMINATION_FILE} file, + It automatically adds a properly formatted nomination to the #{ASF::MemberFiles::NOMINATED_MEMBERS} file, and will then } _strong 'send an email to the members@ list'
