Skip to content

Commit

Permalink
Merge branch 'main' into force-users-to-ack-privacy-notice
Browse files Browse the repository at this point in the history
  • Loading branch information
mwvolo authored Nov 29, 2023
2 parents 01e6e35 + fd86ffd commit e7e7cec
Show file tree
Hide file tree
Showing 38 changed files with 447 additions and 1,083 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ gem 'will_paginate'
gem 'chronic'

# Salesforce
gem 'openstax_salesforce', git: 'https://github.com/openstax/openstax_salesforce.git', ref: 'b250271c38a06ce2957d20919f028099f69cf752'
gem 'openstax_salesforce'

# Allows 'ap' alternative to 'pp', used in a mailer
gem 'awesome_print'
Expand Down
92 changes: 51 additions & 41 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,6 @@ GIT
railties (>= 3.1)
sass-rails

GIT
remote: https://github.com/openstax/openstax_salesforce.git
revision: b250271c38a06ce2957d20919f028099f69cf752
ref: b250271c38a06ce2957d20919f028099f69cf752
specs:
openstax_salesforce (6.3.0)
openstax_active_force
rails (>= 5.0, < 7.0)
restforce

GIT
remote: https://github.com/openstax/path_prefixer.git
revision: 8298c40ec38f132fc23ea946b2b20e855fe73a49
Expand Down Expand Up @@ -68,10 +58,10 @@ GEM
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
active_attr (0.15.4)
actionpack (>= 3.0.2, < 7.1)
activemodel (>= 3.0.2, < 7.1)
activesupport (>= 3.0.2, < 7.1)
active_attr (0.16.0)
actionpack (>= 3.0.2, < 7.2)
activemodel (>= 3.0.2, < 7.2)
activesupport (>= 3.0.2, < 7.2)
activejob (5.2.4.4)
activesupport (= 5.2.4.4)
globalid (>= 0.3.6)
Expand Down Expand Up @@ -208,6 +198,7 @@ GEM
css_parser (1.4.5)
addressable
database_cleaner (1.8.5)
date (3.3.4)
db-query-matchers (0.6.0)
debase (0.2.4.1)
debase-ruby_core_source (>= 0.10.2)
Expand Down Expand Up @@ -316,7 +307,7 @@ GEM
formatador (0.2.5)
get_process_mem (0.2.7)
ffi (~> 1.0)
globalid (1.0.1)
globalid (1.1.0)
activesupport (>= 5.0)
guard (2.14.0)
formatador (>= 0.2.4)
Expand All @@ -338,7 +329,7 @@ GEM
guard-compat (~> 1.1)
rspec (>= 2.99.0, < 4.0)
hashdiff (1.0.1)
hashie (4.1.0)
hashie (5.0.0)
highline (2.0.2)
htmlentities (4.3.4)
http_accept_language (2.1.1)
Expand Down Expand Up @@ -370,7 +361,7 @@ GEM
activesupport (>= 4.2)
aes_key_wrap
bindata
jwt (2.2.3)
jwt (2.7.1)
keyword_search (1.5.0)
knockoutjs-rails (3.5.0)
railties (>= 3.1, < 6)
Expand All @@ -397,12 +388,15 @@ GEM
activesupport (>= 4)
railties (>= 4)
request_store (~> 1.0)
loofah (2.20.0)
loofah (2.22.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
nokogiri (>= 1.12.0)
lumberjack (1.0.10)
mail (2.7.1)
mail (2.8.1)
mini_mime (>= 0.1.1)
net-imap
net-pop
net-smtp
marcel (0.3.3)
mimemagic (~> 0.3.2)
maruku (0.7.3)
Expand All @@ -413,23 +407,32 @@ GEM
mimemagic (0.3.10)
nokogiri (~> 1)
rake
mini_mime (1.1.2)
mini_portile2 (2.8.4)
mini_mime (1.1.5)
mini_portile2 (2.8.5)
mini_racer (0.6.2)
libv8-node (~> 16.10.0.0)
minitest (5.18.0)
minitest (5.20.0)
msgpack (1.5.2)
multi_json (1.15.0)
multi_xml (0.6.0)
multipart-post (2.1.1)
multipart-post (2.3.0)
nenv (0.3.0)
nio4r (2.5.9)
nokogiri (1.15.4)
net-imap (0.4.6)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.2)
timeout
net-smtp (0.4.0)
net-protocol
nio4r (2.6.1)
nokogiri (1.15.5)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nokogiri (1.15.4-x86_64-darwin)
nokogiri (1.15.5-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.15.4-x86_64-linux)
nokogiri (1.15.5-x86_64-linux)
racc (~> 1.4)
notiffany (0.1.0)
nenv (~> 0.1)
Expand Down Expand Up @@ -484,6 +487,10 @@ GEM
rails (>= 3.0)
openstax_rescue_from (4.2.0)
rails (>= 3.1, < 7.0)
openstax_salesforce (7.6.1)
openstax_active_force
rails (>= 5.0, < 7.0)
restforce
openstax_utilities (5.0.0)
aws-sdk-autoscaling
faraday
Expand Down Expand Up @@ -516,8 +523,8 @@ GEM
puma_worker_killer (0.3.1)
get_process_mem (~> 0.2)
puma (>= 2.7)
racc (1.7.1)
rack (2.2.7)
racc (1.7.3)
rack (2.2.8)
rack-contrib (2.3.0)
rack (~> 2.0)
rack-cors (1.1.1)
Expand All @@ -541,16 +548,18 @@ GEM
actionpack (>= 5.0.1.x)
actionview (>= 5.0.1.x)
activesupport (>= 5.0.1.x)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-erd (1.5.2)
activerecord (>= 3.2)
activesupport (>= 3.2)
choice (~> 0.2.0)
ruby-graphviz (~> 1.2)
rails-html-sanitizer (1.5.0)
loofah (~> 2.19, >= 2.19.1)
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
rails-i18n (5.1.3)
i18n (>= 0.7, < 2)
railties (>= 5.0, < 6)
Expand All @@ -568,7 +577,7 @@ GEM
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
rainbow (3.0.0)
rake (13.0.6)
rake (13.1.0)
rb-fsevent (0.11.0)
rb-inotify (0.10.1)
ffi (~> 1.0)
Expand Down Expand Up @@ -603,8 +612,8 @@ GEM
responders (3.0.1)
actionpack (>= 5.0)
railties (>= 5.0)
restforce (5.2.3)
faraday (>= 0.9.0, < 1.9.0)
restforce (5.3.1)
faraday (>= 0.9.0, <= 1.10.0)
faraday_middleware (>= 0.8.8, <= 2.0)
hashie (>= 1.2.0, < 6.0)
jwt (>= 1.5.6)
Expand Down Expand Up @@ -702,7 +711,7 @@ GEM
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.4.0)
sprockets-rails (3.4.2)
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
Expand All @@ -711,10 +720,11 @@ GEM
test_xml (0.1.8)
diffy (~> 3.0)
nokogiri (>= 1.3.2)
thor (1.2.1)
thor (1.3.0)
thread_safe (0.3.6)
tilt (2.0.10)
timecop (0.8.1)
timeout (0.4.1)
transaction_isolation (1.0.5)
activerecord (>= 3.0.11)
transaction_retry (1.0.3)
Expand All @@ -741,7 +751,7 @@ GEM
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
websocket (1.2.9)
websocket-driver (0.7.5)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
whenever (0.9.7)
Expand Down Expand Up @@ -828,7 +838,7 @@ DEPENDENCIES
openstax_healthcheck
openstax_path_prefixer!
openstax_rescue_from
openstax_salesforce!
openstax_salesforce
openstax_utilities
p3p
parallel_tests
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def mark_users_updated
end

def force_update_lead
Newflow::CreateSalesforceLead.call(user: get_user)
Newflow::CreateOrUpdateSalesforceLead.call(user: get_user)
end

protected
Expand Down
2 changes: 1 addition & 1 deletion app/handlers/newflow/confirm_oauth_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def handle
transfer_errors_from(@user, {type: :verbatim}, :fail_if_errors)

agree_to_terms(@user) if options[:contracts_required] && signup_params.terms_accepted
run(StudentSignup::ActivateStudent, @user)
run(StudentSignup::ActivateStudent, user: @user)

outputs.user = @user
end
Expand Down
21 changes: 7 additions & 14 deletions app/handlers/newflow/educator_signup/complete_profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,27 +97,20 @@ def handle
# so let's add it - validation happens before this in check_params
run(CreateEmailForUser, email: signup_params.school_issued_email, user: @user, is_school_issued: true)
end

if user.school.nil? && !signup_params.school_name.blank?
user.school = School.fuzzy_search name
user.save
end
end

transfer_errors_from(@user, {type: :verbatim}, :fail_if_errors)

CreateOrUpdateSalesforceLead.perform_later(user: @user)

#output the user to the lev handler
outputs.user = @user

if !user.is_educator_pending_cs_verification && !user.sheer_id_webhook_received
# User used SheerID or needs CS verification - we create their lead in SheeridWebhook, not here.. and might not be instant
SecurityLog.create!(
user: user,
event_type: :lead_creation_awaiting_sheerid_webhook,
)
return
end
# otherwise, we already heard from SheerID, so let's create the lead.
# We check in SheeridWebhook to see if they completed their profile before creating lead

# Now we create the lead for the user... because we returned above if they did... again SheeridWebhook
CreateSalesforceLead.perform_later(user: @user)

end

private #################
Expand Down
7 changes: 2 additions & 5 deletions app/handlers/newflow/educator_signup/sheerid_webhook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,8 @@ def handle(verification_id=nil)
event_data: { verification: verification_details_from_sheerid.inspect })
end

# if we got the webhook back after the user submitted the profile, they didn't get a lead built yet
# We just make sure they don't have a lead or contact id yet
if user.salesforce_lead_id.blank? && user.salesforce_contact_id.blank? && user.is_profile_complete
CreateSalesforceLead.perform_later(user: user)
end
CreateOrUpdateSalesforceLead.perform_later(user: user)


SecurityLog.create!(user: user, event_type: :sheerid_webhook_processed)
outputs.verification_id = verification_id
Expand Down
2 changes: 1 addition & 1 deletion app/handlers/newflow/student_signup/verify_email_by_pin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def handle
private #################

def activate_user(claiming_user)
run(ActivateStudent, claiming_user)
run(ActivateStudent, user: claiming_user)
end

end
Expand Down
2 changes: 1 addition & 1 deletion app/handlers/verify_email_by_code.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def handle
user = outputs.contact_info.user

if user.student?
run(Newflow::StudentSignup::ActivateStudent, user)
run(Newflow::StudentSignup::ActivateStudent, user: user)
else
run(Newflow::EducatorSignup::ActivateEducator, user: user)
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def lead
end

def contact
OpenStax::Salesforce::Remote::Contact.find_by(id: salesforce_contact_id)
OpenStax::Salesforce::Remote::Contact.find(salesforce_contact_id)
end

def most_accurate_school_name
Expand Down
Loading

0 comments on commit e7e7cec

Please sign in to comment.