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

add bitcoin receiving address to profile #1437

Closed
wants to merge 7 commits into from

Conversation

reedlaw
Copy link
Contributor

@reedlaw reedlaw commented Sep 12, 2013

For issue #1164

@chadwhitacre
Copy link
Contributor

@reedlaw This is a great first pull request, thanks! :D

The one thing we need here that isn't obvious or documented (yet! coming soon) is that we want to log changes to the columns in the participants table. The way we're doing that is with a rule that in this case would log to a bitcoin_addresses table. See schema.sql for examples. Please create a branch.sql file and put the new DDL in there.

Also, #gittip on Freenode is a great place to connect if you're comfortable with IRC and want to chat about this.

@@ -37,6 +37,7 @@ CREATE TABLE participants
-- stored here as an optimization and sanity check.
, balance numeric(35,2) DEFAULT 0.0
, pending numeric(35,2) DEFAULT NULL
, bitcoin_address text DEFAULT NULL
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't blame you because we haven't documented it yet (#1272), but schema changes need to go in a branch.sql file. schema.sql is append-only. Also, we need a rule that logs changes to participants.bitcoin_address into a bitcoin_addresses table. See schema.sql for examples.

@reedlaw
Copy link
Contributor Author

reedlaw commented Sep 12, 2013

I wasn't sure what the branch.sql should look like so I appended the rule to schema.sql.

@chadwhitacre
Copy link
Contributor

@reedlaw I'm debating whether to ask you for tests on this. :-)

We don't have client-side tests in place yet, but there are tests for other json endpoints that you should be able to use as a starting point for testing www/bitcoin.json.spt. And now that I notice it, I believe the endpoint should be under www/%username/ to be parallel to other endpoints that the profile page uses.

@wyze
Copy link
Contributor

wyze commented Sep 12, 2013

@whit537 @reedlaw Yes, please add tests for any new JSON endpoints. Same guidelines, if you alter an existing JSON endpoint, make sure there are tests along with it.

@chadwhitacre
Copy link
Contributor

@reedlaw Copy/paste the code you added to schema.sql into branch.sql and you're all set with that. Having the new DDL in branch.sql enables me to run \i branch.sql in psql to apply the schema change in production.

@rummik
Copy link
Contributor

rummik commented Sep 12, 2013

Can we get this in a key in public.json?

@chadwhitacre
Copy link
Contributor

@rummik If @reedlaw doesn't tackle that here we'll do it in a separate PR.

@rummik
Copy link
Contributor

rummik commented Sep 12, 2013

@whit537 I figured I'd voice it now since it isn't a huge thing :P If it isn't added here, I'll volunteer to add it later :)

@reedlaw
Copy link
Contributor Author

reedlaw commented Sep 13, 2013

Ok, I think I've addressed all the issues in my latest commit. Please have a look.

@chadwhitacre
Copy link
Contributor

I've tested this in the UI and I can save this example address:

1JwSSubhmg6iPtRjtyqhUYYH7bZg3Lfy1T

I've asked @reedlaw in IRC to implement the UI as inline ajax based on the example in #1287 rather than as a separate page (as with the credit card and bank pages).

We also need to make sure that we have Unix line-endings (test_bitcoin_json.py appears to have CRLF?).

The tests are failing for me. I get 11 errors out (out of 285 tests) with ValueError: No JSON object could be decoded. This looks like something that either @zwn or @wyze or both saw before. Maybe they can shed some light?

@reedlaw
Copy link
Contributor Author

reedlaw commented Sep 13, 2013

I fixed the failing test. It was due to adding bitcoin_address to public.json without checking for null. The line-endings came from my making a copy test_statement_json.py which is DOS format.

Now all the tests are passing and the bitcoin address field is inline on the profile page.

@chadwhitacre
Copy link
Contributor

The line-endings came from my making a copy test_statement_json.py which is DOS format.

Ah, good catch, sorry. Looks like it's the only one:

[gittip] $ grep -lr $'\r' tests gittip www | grep -v assets | grep -v favicon
tests/test_statement_json.py

I've updated it on master.

@chadwhitacre
Copy link
Contributor

Steps

  • Add a bitcoin address to one account.
  • Sign in using a different account.
  • View the profile of the first account, the one with the bitcoin address attached.
  • Right-click on the bitcoin address and "open in new tab/window"

Expected: New tab opens, profile tab stays unchanged.

Actual: New tab opens, bitcoin address is apparently editable on profile tab(!).

@reedlaw
Copy link
Contributor Author

reedlaw commented Sep 18, 2013

@whit537 good catch! It was a javascript bug that I've now fixed. It didn't actually allow anyone to edit another user's bitcoin address. If you crafted the HTML to submit the form it would still only edit your own user's bitcoin address.

@chadwhitacre
Copy link
Contributor

@reedlaw

steps

  • sign in
  • add a bitcoin address
  • click on the bitcoin address I just added

expected: profile page stays the same, and I am sent to a blockchain.info page

actual: profile page switches to "edit" mode for bitcoin address, and then I am sent to a blockchain.info page

@chadwhitacre
Copy link
Contributor

@reedlaw How are we doin' here? Can we fix that last bug so we can land this? P.S. Would be good to sync master out to your branch since it's moved a bit.

Let's bring this in for a landing! ✈️

@reedlaw
Copy link
Contributor Author

reedlaw commented Oct 3, 2013

Still settling after a move. Hope I get a chance soon...

On Thu, Oct 3, 2013 at 4:06 PM, Chad Whitacre notifications@github.comwrote:

@reedlaw https://github.com/reedlaw How are we doin' here? Can we fix
that last bug so we can land this? P.S. Would be good to sync master out to
your branch since it's moved a bit.

Let's bring this in for a landing! [image: ✈️]


Reply to this email directly or view it on GitHubhttps://github.com//pull/1437#issuecomment-25653426
.

Reed Law
Senior Developer
Smashing Boxes

@chadwhitacre
Copy link
Contributor

Thanks for the pingback, @reedlaw. Keep us posted. :-)

@reedlaw
Copy link
Contributor Author

reedlaw commented Oct 10, 2013

Let me know if that last commit works for you.

@zwn
Copy link
Contributor

zwn commented Oct 11, 2013

Hey @reedlaw! Could you please

  • merge current master into your branch/repo/pull-request
  • fix failing test line 34, in test_github_user_info_status_handling (make sure the test suite passes)
  • fix logging to the bitcoin_addresses table

steps

  • sign in
  • add a bitcoin address
  • remove bitcoin address

expected: bitcoin_addresses contains two lines, one with the the address and one with empty string

actual: bitcoin_addresses contains one entry with empty string

See for example the goals table and how changes are recorded there when the goal is changed.

@chadwhitacre
Copy link
Contributor

@zwn The failing test is due to branch drift from master?

Also, good call on logging bitcoin_address changes. @reedlaw Sorry we don't have better docs yet on how that's handled. Catch @zwn or I in IRC if you need more pointers.

@zwn
Copy link
Contributor

zwn commented Oct 11, 2013

@whit537 I don't know. I'd first merge master and start fixing after that. It might be something spurious.

@clone1018
Copy link
Contributor

What are we doing now with this pull request?

@chadwhitacre
Copy link
Contributor

It's pretty good, but we lost @reedlaw. Ideally we'd dust it off and land it. It's not too complicated and not too far from done.

@reedlaw
Copy link
Contributor Author

reedlaw commented Dec 30, 2013

@whit537 I'm sorry, I started this when I had a big chunk of time but since getting back to work I haven't had time to pursue it. I may have time in a month or so, or feel free to let someone take over and finish this.

@chadwhitacre
Copy link
Contributor

@reedlaw No worries, thanks for checking in. Sorry I try harder to land this three months ago. :-/

@galuszkak
Copy link
Contributor

@reedlaw @whit537 As proposed on IRC I will try to continue and finish this ticket.

@ghost ghost assigned galuszkak Jan 2, 2014
@chadwhitacre
Copy link
Contributor

!m @galuszkak

@galuszkak
Copy link
Contributor

hey @zwn seems that test are passing now after merge without any problems...

I will create pull request with merge.

galuszkak added a commit to Solution4Future/www.gittip.com that referenced this pull request Jan 4, 2014
This introduces bitcoin address field in gittip profile
@seanlinsley
Copy link
Contributor

Moving over to #1814

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

Successfully merging this pull request may close these issues.

None yet

8 participants