Skip to content

Wipes plaintext email for students from Poste2.#9545

Merged
ashercodeorg merged 2 commits into
stagingfrom
poste2
Jul 16, 2016
Merged

Wipes plaintext email for students from Poste2.#9545
ashercodeorg merged 2 commits into
stagingfrom
poste2

Conversation

@ashercodeorg

Copy link
Copy Markdown
Contributor

Adds significant test coverage to existing methods.

Comment thread lib/cdo/poste.rb
contact[:email] = email
sanitized_email = Poste.dashboard_student?(hashed_email) ? '' : email
id = POSTE_DB[:contacts].insert({}.tap do |contact|
contact[:email] = sanitized_email

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not important: I know you didn't write this code, and it's mostly extraneous to this PR, but any idea why it's using {}.tap rather than just creating a hash inline?

That seems a strange and unnecessary pattern. The only reason I can see is the optional name field, but since this is inserting in the DB wouldn't a hash with name: nil resolve to the same thing as as a hash with no name key?

It can be converted to:

id = POSTE_DB[:contacts].insert({
  email: sanitized_email,
  hashed_email: hashed_email,
  name: name,
  #...
})

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nope. And I'm happy to "fix" in a followup PR.

@aoby

aoby commented Jul 15, 2016

Copy link
Copy Markdown
Contributor

Nice new test coverage!

It looks like some setup is missing (or I am missing something). See above comments.

@aoby

aoby commented Jul 15, 2016

Copy link
Copy Markdown
Contributor

LGTM with the setup in the 2nd commit, presuming tests pass.

@ashercodeorg ashercodeorg merged commit df264b9 into staging Jul 16, 2016
@ashercodeorg ashercodeorg deleted the poste2 branch July 16, 2016 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants