Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maintenance #37

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

beanieboi
Copy link
Member

This is a PR to addresses some minimal maintenance work.

Which includes:

  • upgrading gems
  • move from Unicorn/Thin to Puma
  • Upgrade Ruby to 2.5
  • Remove broken Gravatar integration
  • Replace Rollbar with Sentry
  • tests are running again and are green

Things that needs to be addressed

  • need a new Sentry DSN (needs to be set as ENV var on Heroku)
  • how to test the stripe integration? Not sure how much is covered by tests

Copy link
Member

@carpodaster carpodaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @beanieboi – thanks a ton!

I've added some comments; mostly about the givie token change and the Gravatar replacement.

@@ -56,5 +56,5 @@ def stub_stripe_methods
allow_any_instance_of(Donation).to receive(:stripe_create_charge)
end

ENV['GIVIE_SECRET']="this is the testing secret. it is not very secret"
ENV['GIVIE_SECRET'] = "2d2dd11b2d4d9c55a38db15ff40ee826"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a real thing? I would prefer to leave the original value so that we can be sure not to have checked in real tokens

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the requirements for ActiveSupport::MessageEncryptor.new changed, it requires a 32 byte key now. Using the old secret gives a ArgumentError: key must be 32 bytes

I can cut down the original string to 32 chars.

before do
ENV['GIVIE_SECRET'] = "kitten sandwich is a strange project name"
ENV['GIVIE_SECRET'] = "77a115a459b0499bd8719d5143113fe1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a real thing? I would prefer to leave the original value so that we can be sure not to have checked in real tokens

@@ -0,0 +1,36 @@
class Gravatar
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we move this to lib/? There are of course different schools about where to put what. Personally, I like lib to be a place that has no ties to the domain of the app and could be used somewhere else without changes. A gravatar generator qualifies for this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will move it to lib/

Digest::MD5.hexdigest(email.downcase.strip)
end

def extension_for_image(options)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're only using two keys. Can we use kwargs instead of the options hash?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My goal was to keep the original API. I'm ok with not doing that, I just wanted to keep the changes as minimal as possible. I can rewrite the Gravatar class to only support our usage


def query_for_image(options)
query = ''
[:rating, :size, :default, :forcedefault, :r, :s, :d, :f].each do |key|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make these kwargs?

@email = email
end

def image_url(options = {})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove the ssl option and use https by default

class Gravatar
attr_reader :email

def initialize(email, options = {})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't seem to use options. Let's remove it

attr_reader :email

def initialize(email, options = {})
raise ArgumentError, "Expected :email" unless email
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove the condition by making email a required kwarg. We can rely on the parser to ensure argument correctness:

def initialize(email:)
  @email = email
end

@alicetragedy
Copy link
Member

I'd prefer to leave the review up to someone who understands the campaign app better than me <3 but please ping me if you need anything from my side @beanieboi!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants