Skip to content

Commit 4fa6f6e

Browse files
peterkosJeremyRudmancbaudouinjr
authored
master <- develop (2.1.4) (#520)
* fix(questionnaire): missing information now in correct place (#443) * fix(questionnair): missing information now in correct place it now displays the correct message "Please read & accept" instead of missing information and the notification is now in the correct place * Update app/assets/javascripts/validate.js * Revert "Update app/assets/javascripts/validate.js" This reverts commit bc54783. Signed-off-by: Peter Kos <[email protected]> Co-authored-by: Peter Kos <[email protected]> * fix: Fixes mobile agreements layout bug Signed-off-by: Peter Kos <[email protected]> * feat: Removes semantic-release (#446) * refactor: Moves CI to develop branch (#449) Co-authored-by: Peter Kos <[email protected]> * build: Merges 2.1.2 into develop * fix(hakiri): corrected unescaped model attribute * fix(hakiri): added html_safe to show proper output Co-authored-by: Jeremy Rudman <[email protected]> Co-authored-by: JeremyRudman <[email protected]> * fix: Shows questionnaires_closed_message on registration * feat: Allows agreements to be fully customizable (#465) * feat: Allows agreements to be fully customizable * fix: Fixes broken migrations * fix: Migrations misname issue * feat: Forces agreement links to open in new tab * Agreement validation detection fixed Signed-off-by: Peter Kos <[email protected]> * refactor: Removes old input hint Co-authored-by: Peter Kos <[email protected]> * fix(hakiri): fixed un-escaped regex for vcs link (#467) * fix(hakiri): corrected unescaped model attribute * fix(hakiri): added html_safe to show proper output * fix(hakiri): added \A \z to regex * fix(questionnaire): fixed hakiri error with vcs link regex * fix(questionnaire): fixed houndci commplaint Co-authored-by: Chris Baudouin, Jr <[email protected]> * fix(hakiri): fix hakiri error with user input in html_safe (#475) Co-authored-by: Peter Kos <[email protected]> * fix: Uninstalls deprecated chromedriver (#484) * fix: VCS regex matches all valid usernames for each provider; URLs are now case-insensitive, dokku check extended (#485) * fixed vcs regex to allow upper case added a extra test to vcs links to test upper case links. also made it so portfolio links ands vcs links are stored in lower case * fixed houndci complaints * lossened username regex and add another test * made regex more pleasing to read * made regex method more readable * checks now does 300 attempts * 2.1.4 <- develop (#519) * fix: Resolves issue preventing new MyMLH users from creating questionnaires (#516) * fix: Resolves issue preventing new MyMLH users from creating questionnaires * refactor: Cleans code * Attempt to pull any # of params from MyMLH frontend validation is triggered via page skip, whether successful (will skip) or not (no skip) * Cange error msg, pet hound Co-authored-by: Peter Kos <[email protected]> * vcs url error now displayed in edit application page (#518) changed from redirect_to to render "edit" on error. redirect_to makes a fresh request which causes the error information to be lost Co-authored-by: Chris Baudouin, Jr <[email protected]> Co-authored-by: JeremyRudman <[email protected]> Co-authored-by: JeremyRudman <[email protected]> Co-authored-by: Chris Baudouin, Jr <[email protected]> Co-authored-by: Jeremy Rudman <[email protected]>
1 parent 2b14f72 commit 4fa6f6e

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

app/controllers/questionnaires_controller.rb

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ def logged_in
1111
# GET /apply
1212
# GET /apply.json
1313
def show
14+
flash[:alert] = nil
1415
respond_to do |format|
1516
format.html # show.html.erb
1617
format.json { render json: @questionnaire }
@@ -29,17 +30,23 @@ def new
2930
if session["devise.provider_data"] && session["devise.provider_data"]["info"]
3031
info = session["devise.provider_data"]["info"]
3132
@skip_my_mlh_fields = true
33+
unless all_my_mlh_fields_provided?
34+
flash[:notice] = nil
35+
flash[:alert] = t(:my_mlh_null, scope: 'errors')
36+
end
3237
@questionnaire.tap do |q|
3338
q.phone = info["phone_number"]
3439
q.level_of_study = info["level_of_study"]
3540
q.major = info["major"]
3641
q.date_of_birth = info["date_of_birth"]
3742
q.gender = info["gender"]
3843

39-
school = School.where(name: session["devise.provider_data"]["info"]["school"]["name"]).first_or_create do |s|
40-
s.name = session["devise.provider_data"]["info"]["school"]["name"]
44+
if info["school"]
45+
school = School.where(name: info["school"]["name"]).first_or_create do |s|
46+
s.name = info["school"]["name"]
47+
end
48+
q.school_id = school.id
4149
end
42-
q.school_id = school.id
4350
end
4451
end
4552

@@ -84,12 +91,13 @@ def update
8491
update_params = questionnaire_params
8592
update_params = convert_school_name_to_id(update_params)
8693

94+
@agreements = Agreement.all
8795
respond_to do |format|
8896
if @questionnaire.update_attributes(update_params)
8997
format.html { redirect_to questionnaires_path, notice: 'Application was successfully updated.' }
9098
format.json { head :no_content }
9199
else
92-
format.html { redirect_to edit_questionnaires_url }
100+
format.html { render action: "edit" }
93101
format.json { render json: @questionnaire.errors, status: :unprocessable_entity }
94102
end
95103
end
@@ -124,6 +132,14 @@ def schools
124132

125133
private
126134

135+
def all_my_mlh_fields_provided?
136+
info = session["devise.provider_data"]["info"]
137+
138+
return true unless info["phone_number"].blank? || info["level_of_study"].blank? || info["major"].blank? ||
139+
info["date_of_birth"].blank? || info["gender"].blank? || info["school"].blank? ||
140+
info["school"]["name"].blank?
141+
end
142+
127143
def questionnaire_params
128144
params.require(:questionnaire).permit(
129145
:email, :experience, :gender,

config/locales/en.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ en:
3636
registrations:
3737
user:
3838
signed_up: Welcome! Your account has been created.
39+
errors:
40+
my_mlh_null: Some information from MyMLH is missing, please fill in the missing fields.
3941
simple_form:
4042
hints:
4143
bus_list:
@@ -136,7 +138,7 @@ en:
136138
title: Bus Lists
137139
schools:
138140
title: Schools
139-
users:
141+
users:
140142
title: Users & Staff
141143
users: All Users
142144
staff: "%{hackathon_name} Staff"

0 commit comments

Comments
 (0)