Some Firefox users may need to log in more than once to log in. It's a known Firefox bug. Check "keep me logged in," it might help.

Es posible que algunxs usuarixs de Firefox tengan que conectarse más de una vez para iniciar sesión. Es un error conocido de Firefox. Marca "keep me logged in" (mantenerme conectado), puede ayudar.


Tech Meeting 2022.07.16

From Bike Collectives Wiki
Revision as of 23:42, 19 August 2022 by DarinWick (talk | contribs) (→‎Working with the current bikebike.org server)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Last-minute tech meeting with Jonathan Rosenbaum to look at integrating OCF with bikebike software for payments.

This meeting was continued on 2022.07.17; notes from that day are included on this page as well.

Attendees: Darin, Jonathan, technically Angel also present

  • OCF doesn't offer a paypal account, only paypal integration
  • trying to avoid using paypal
  • bikebike.org is only set up to work with paypal
  • how to add an i-frame JUST for B!B!E! without doing it for all the B!B! events too?

Goals:

1. Establish where to make the changes in the application, which can be done with search and grepping.

2. Figure out the implementation, which depends on where the changes shall be. I assume that is in [example link] https://en.bb.bikelover.org/conferences/Northeast2022/register/ .


Notes

  • Any changes to the code require a restart to the server to take effect
    • We're not sure if we know how to start the server correctly
    • Godwin said don't do it.
    • Restarting the server is a Godwin Thing
  • The only person with DNS access to bikebike.org is Godwin

Notes from the continued meeting on 2022.07.17:

  • Darin spent the day getting the wiki to stop timing out to the point where it's literally unusable. Now instead of unusable, we're just missing the visual editor. So it's a different kind of unusable. I spoke too soon. It's still slow, but not as bad as it was. Needs further work.
  • Jonathan got the OCF iframe working in the test website.
  • Jonathan and Darin continue to do forensics on Godwin's code.
  • We need Godwin to say we won't break anything by restarting the server. Until we restart the server, we won't have the donate feature integrated into the bikebike.org registration form even though the launch party starts tomorrow. Instead there will be a non-functional paypal button.
  • Darin texted Godwin earlier today and hasn't heard back yet. Texted again. Angel emailing.
  • They also took a look at why the wiki was slow. Didn't fix it, but it was nice to hear them going "oh yeah wow that's really slow". Something about losing lots and lots of percents of packets.
  • Visual editor is gone from the wiki to try to make the wiki less slooooooowwwww for editing. Sorta helped a little but now it's harder for people to make edits.


Some Things we Learned

Background

"I really want to drive home right now through that this server is very fragile at the moment, the code on the server has changed slightly from the repo due to several high severity issues over the years." -Godwin

Working with the current bikebike.org server

We learned a little more by checking .bash_history (the history of commands that have been run on the linux command line) and .irb-history (the history of commands that have been run in the rails console:

  • It looks like minor changes (anything stored in the database?) can be made from the rails console, accessible by running:
cd /home/rails
RAILS_ENV=production bundle exec rails c

Note that this will make live changes to the production website. It could probably break things in pretty dramatic ways. It's also what you would use to change subtitles or slugs by altering the contents of items in the variable Conference.

  • Pretty sure this restarts the webserver:
kill `cat /home/unicorn/production.pid`; RAILS_ENV=production bundle exec unicorn_rails -E production -D -c /home/rails/config/unicorn.rb
  • This looks like it rebuilds all the assets and restarts everything UPDATE 2022.08.19 this seems to rebuild Bumbleberry, which must be done occasionally when a new browser version comes out and Bumbleberry doesn't know what to do, and so the site appears in the new browser with a giant B&W logo at the top and generally no CSS:
truncate nohup.out -s 0 && nohup sh -c 'cd /home/rails && RAILS_ENV=production bundle exec rake bumbleberry:update && RAILS_ENV=production bundle exec rake assets:precompile && RAILS_ENV=production bundle exec rake assets:clean && kill `cat /home/unicorn/production.pid`; RAILS_ENV=production bundle exec unicorn_rails -E production -D -c /home/rails/config/unicorn.rb && kill `cat /home/unicorn/sidekiq_production.pid`; bundle exec sidekiq -d -C config/sidekiq_production.yml -e production -c 25' &

nohup makes the process keep running after the user has logged out. I don't really know what the rest of it is doing.

Editing the code to integrate OCF stuff

As far as OCF integration is concerned, it could go in a few places...

  • The page where you choose the payment type appears to be in app/views/registration_steps/_payment_type.html.haml. Editing that might allow us to hack in some logic so it changes only one conference, not all conferences ever. It's more challenging, though, because it requires making the edits in HAML/Ruby
  • The text on that page is defined in config/locales/[LANGUAGE CODE].yml where [LANGUAGE CODE] is en, es, or fr. That file contains all predefined text blocks in the app; you can find the correct one by searching for "If you can, please pay now via PayPal." If we edit that, it will be edited for all conferences ever. It's simpler, because we can probably just drop some HTML in there - like the iframe with the OCF Contribution Flow

We wound up editing app/views/registration_steps/_payment_form.html.haml. We were able to add a conditional statement so the OCF iframe is only shown for a B!B!E!22 and other conferences still get the normal paypal button. Jonathan also figured out how to prefill the form with the name & email already entered during the registration process.

Content of edited _payment_form.html.haml:

- if @confirm_payment
  = registration_step_header(:confirm_payment, description: { amount: (number_to_currency @confirm_amount, unit: '$'), currency: @confirm_currency })
  = row do
    = columns(medium: 12) do
      = save_registration_step(@this_conference, :confirm_payment)
- else
  = registration_step_header
  = row do
    = columns(medium: 12) do
      - unless @currencies.present? && @currencies.length > 1
        %p.center=_"articles.conference_registration.paragraphs.currency_details", :p, vars: { currency: (_"currencies.#{(@currencies || [@currency]).first}.displayName-count-other") }
      = save_registration_step do
        - if @conference.slug == "Northeast2022"
          %iframe{:src => "https://opencollective.com/embed/bikebike-everywhere/donate?email=#{current_user.email}&name=#{current_user.firstname} #{current_user.lastname}", :style => "width: 100%; min-height: 100vh;"}
        - elsif @conference.slug == "Mexico2022"
          .registration-step-options
            .options.graded-options{class: "option-count-#{@amounts.size}"}
              - @amounts.each_with_index do |option, i|
                = button "#{number_to_currency option, unit: '$'} #{_!@currency}".html_safe, value: option, name: :value, class: [:unstyled, "option-#{i + 1}"]
            .option-space
            .custom-option
              = number_field_tag :custom_value, 50.0, step: 0.05, min: 0.05
              = button :custom_amount, name: :custom_amount, value: :custom, class: :unstyled
            - if @currencies.present? && @currencies.length > 1
              .option-space
              .setting-option
                %p Change currency to:
                - (@currencies - [@currency]).each do |c|
                  = button (_"currencies.#{c}.displayName-count-other"), name: :currency, value: c, class: :unstyled

Minor edits to the localization files (config/locales/[LANGUAGE CODE].yml where [LANGUAGE CODE] is en, es, or fr) are necessary as well - changing "PayPal" to "online" in the lines "If you can, please pay now via PayPal." and "I can pay now with PayPal"

Jonathan tested these changes on his own instance of the bikebike.org software and it worked!

Integrating OCF Stuff: Second Attempt

  • The method described above doesn't work! You can enter your payment details, but it won't give you a "Next" button to continue to the next step. There's something in the code that's looking for a PayPal confirmation before it lets you move on.
  • Alternative solution: Remove the payment step from the process. (remove other irrelevant steps while we're at it) Insert the "Donate" iframe on the "Review" page at the end of the registration process.
    • It looks like you would edit one of the registration_steps methods in conferences_controller.rb or registration_helper.rb. That's wrong! Neither of those methods is actually called; they seem to be vestigial.
    • Instead, you have to change the definition of available_steps in registration_steps.rb. That's in bikecollectives_core, so I (Darin) don't know if you can edit it easily without having to rebuild bikebike.org. Instead, I "monkey patched" the method, redefining it at the beginning of conferences_controller.rb.
    • You can remove steps now, but if you remove the wrong ones then the registration process may hang; never proceeding to the next step. Apparently this behavior can even vary between users?

Another Problem

Sidekiq (the module that sends emails, including login links and error messages) is now saying "Net::SMTPAuthenticationError: 534-5.7.9 Please log in with your web browser and then try again. Learn more at" (yes it cuts off there) (It tried to email me the error message, but it can't send emails so I had to find it in the error logs). I have no idea how to fix this.