Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Add bulk claiming at /on/npm/ #4488

Merged
merged 3 commits into from
Jun 16, 2017
Merged

Add bulk claiming at /on/npm/ #4488

merged 3 commits into from
Jun 16, 2017

Conversation

chadwhitacre
Copy link
Contributor

@chadwhitacre chadwhitacre commented May 26, 2017

Picking up from #4416.

Todo

  • move package API to a mixin: Refactor ahead of bulk npm #4495
  • insert into emails during make_participant: Refactor ahead of bulk npm #4495
  • add get_packages_for_claiming
  • modify get_packages_for_claiming to sort/group as desired
  • link to the email settings page
  • set the avatar as the npm logo
  • disable apply when there are no claimable packages
  • indicate when a package is already claimed, differentiating claimed-by-self and -by-other
  • fix test suite
  • wire up to emails/modify.json, send to address displayed
  • verify that we test what happens when someone tries to claim an already claimed package
  • reuse open review ticket where possible—bumping to Reuse open review tickets where possible #4505
  • tie into review process better

@chadwhitacre
Copy link
Contributor Author

Working up a ttw test.

screen shot 2017-05-31 at 5 07 01 am

@chadwhitacre
Copy link
Contributor Author

I'm working on this commit that actually adds the email address during make_participant (instead of just blindly inserting it). It's a simple change (fc36e0c) but has follow-on effects for the rest of the test suite. I'm down to one more failure, and it's weird. It's in test_teams.py, and it's an interaction between several tests, with the failure manifesting in test_error_message_for_slug_collision. It's a failure to overwrite a VCR file—but! it only shows up if five other tests are present. Of the six I've got with it right now (a3872a5) if any of the other five are gone the test passes. If all other six are present then it fails. 🐨

@chadwhitacre
Copy link
Contributor Author

Heck with it. Let's just rerecord the VCR fixture. 😉

@chadwhitacre chadwhitacre mentioned this pull request May 31, 2017
1 task
@chadwhitacre
Copy link
Contributor Author

Moved off this PR into #4495.

@chadwhitacre chadwhitacre changed the base branch from friendlier-401 to bulk-prefactor May 31, 2017 19:04
@chadwhitacre
Copy link
Contributor Author

screen shot 2017-06-02 at 11 23 46 am

@chadwhitacre chadwhitacre changed the base branch from bulk-prefactor to master June 5, 2017 14:53
@chadwhitacre
Copy link
Contributor Author

Rebased on master, was 4587ba8.

@chadwhitacre
Copy link
Contributor Author

Bringing over some local notes:

think through what happens when I put someone else's email in there                                           
    they get a link that's like "Claim your packages on Gratipay!"                                            
    they think, "Um, okay, why not?"                                                                          
        they think that we sent it to them                                                                    
    they click                                                                                                
    they are now sharing an account with an attacker                                                          
                                                                                                              
    I think we need to confirm again on landing                                                               
        "You are linking to thus and such account"                                                            
                                                                                                              
    this is a general problem with email verification, not specific here                                      
                                                                                                              
    At the very least we need to have the message in the email be "Sound familiar?"                           
        Try to communicate that they supposedly initiated the action

@chadwhitacre
Copy link
Contributor Author

screen shot 2017-06-05 at 11 33 37 am

@chadwhitacre
Copy link
Contributor Author

screen shot 2017-06-06 at 5 18 16 pm

@chadwhitacre
Copy link
Contributor Author

Ready for review, @rohitpaulk! Commits are a bit sprawling, pushing the limit on max lines delta. Lmk if I should factor out a PR for ease.

@chadwhitacre
Copy link
Contributor Author

Rebased, was c95af1e.

@mattbk
Copy link
Contributor

mattbk commented Jun 8, 2017

image

It all seems to work for me, but (as a new user), what do I do once I'm here? What's the next step?

I feel like we're not closing the loop toward people knowing what they need to be able to receive money. Maybe this is less of a problem with developers? (i.e., do they read more than regular people?)

@mattbk
Copy link
Contributor

mattbk commented Jun 8, 2017

I like the automatic PayPal route creation if a person doesn't have the PayPal route set up yet. 👍

image

@chadwhitacre
Copy link
Contributor Author

#4515 factored out, was a42f002.

@chadwhitacre chadwhitacre changed the base branch from master to notification-testability June 14, 2017 16:56
@chadwhitacre chadwhitacre changed the base branch from notification-testability to libsass-0.12.3 June 14, 2017 17:04
@chadwhitacre
Copy link
Contributor Author

Also factored out #4516 and #4517. More manageable now, @rohitpaulk? :-)

@chadwhitacre chadwhitacre changed the base branch from libsass-0.12.3 to close-loophole June 14, 2017 17:27
@chadwhitacre
Copy link
Contributor Author

Rebased, was 6fc28cc.

@rohitpaulk rohitpaulk changed the base branch from close-loophole to master June 15, 2017 12:44
{% else %}

{% if not packages_for_claiming %}
<p class="sorry">{{ _("No packages found.") }}</p>
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be worth adding a note saying that we searched using the email addresses a, b, and c - and to update on npm if needed (just like the page for a single package)

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh wait, that is present below. Ignore.

suppress_sidebar = True
website.redirect('/') # nothing here yet
npackages, Npackages = website.db.one('''
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the naming here could be better. These values are only being pulled so that we can show the x packages out of y are on Gratipay - might be better to keep them in a single dict so that a confusion doesn't arise between npackages, Npackages and packages_for_claiming.

How about - npm_stats = website.db.one('''select () as total_packages, () as claimed_packages''', return_as=dict), followed by n=npm_stats.total_packages, N=npm_stats.claimed_packages (in the template)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in abfef42!

@@ -46,7 +47,10 @@ if action in ('add-email', 'resend', 'start-verification'):
raise Response(400)

participant.start_email_verification(address, *packages)
msg = _("Check your inbox for a verification link.")
if show_address_in_message:
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, we always have an address - why not show it in the link?

Copy link
Contributor

Choose a reason for hiding this comment

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

i.e. Why do we have to say Check your inbox when we have an address available

Copy link
Contributor

@rohitpaulk rohitpaulk Jun 15, 2017

Choose a reason for hiding this comment

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

Is it because we send emails to multiple addresses?

Copy link
Contributor

Choose a reason for hiding this comment

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

I only see two emails being sent in start_email_verification - one is a verification notice to the primary email, the other is the actual verification link to the address being verified.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because it's a content spoofing vector. I thought we had a HackerOne ticket about this but it's not jumping out at me on http://inside.gratipay.com/appendices/disclosures.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is confusing 😕

D'oh! 😞

verification.spt is used both to verify emails and to verify linking packages to emails.

Yeah, it seemed to me that it was best to have one code path for both, since we want linking packages to emails to also verify the email. That is, we don't want to make the user go through two verification flows (one for the address itself, a second for the packages) when from their point of view one should be sufficient. Am I thinking about that right?

The pattern of if conditions suggests that there isn't much in common either

Are you referring to the if action == 'start-verification' block? That's the extra bit for the package claiming case, where we load the packages in question. The flows rejoin just after, in the call to start_email_verification, which is where the bulk of the common wiring lives.

I think it is best to separate these out.
i.e. use separate functions (and templates) for verifying an email vs verifying linking an email to a package

I agree it's pretty dense (especially when we get to finish_email_verification), but I think it's necessary to support the simpler, single-step user experience during package claiming. Do you see a way to refactor while preserving the single-step flow?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, it seemed to me that it was best to have one code path for both, since we want linking packages to emails to also verify the email. That is, we don't want to make the user go through two verification flows (one for the address itself, a second for the packages) when from their point of view one should be sufficient. Am I thinking about that right?

I see how this makes sense. In that case, do we absolutely need to re-verify emails when claiming packages? If a user has a verified email, can't we just allow them to claim the package directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Decided in slack to reticket dropping the re-verification.

Copy link
Contributor

Choose a reason for hiding this comment

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

^ Discussed on Slack.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reticketed as #4520.

@chadwhitacre
Copy link
Contributor Author

Rebased, was abfef42.

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

Successfully merging this pull request may close these issues.

4 participants