diff --git a/default_local.env b/default_local.env index 9e44aa6f62..ef090bf4b6 100644 --- a/default_local.env +++ b/default_local.env @@ -26,8 +26,8 @@ NANSWERS_THRESHOLD=2 NMEMBERS_THRESHOLD=50 UPDATE_HOMEPAGE_EVERY=10 BOUNTYSOURCE_API_SECRET=e2BbqjNY60kC7V-Uq1dv2oHgGavbWm9pUJmiRHCApFZHDiY9aZyAspInhZaZ94x9 -BOUNTYSOURCE_API_HOST=https://api-qa.bountysource.com/ -BOUNTYSOURCE_WWW_HOST=https://www-qa.bountysource.com/ +BOUNTYSOURCE_API_HOST=https://staging-qa.bountysource.com +BOUNTYSOURCE_WWW_HOST=https://staging.bountysource.com BOUNTYSOURCE_CALLBACK=http://127.0.0.1:8537/on/bountysource/associate GOOGLE_ANALYTICS_ID= GAUGES_ID= diff --git a/default_tests.env b/default_tests.env index 977bc0c656..3f3d6fc87b 100644 --- a/default_tests.env +++ b/default_tests.env @@ -26,8 +26,8 @@ NANSWERS_THRESHOLD=2 NMEMBERS_THRESHOLD=50 UPDATE_HOMEPAGE_EVERY=10 BOUNTYSOURCE_API_SECRET=e2BbqjNY60kC7V-Uq1dv2oHgGavbWm9pUJmiRHCApFZHDiY9aZyAspInhZaZ94x9 -BOUNTYSOURCE_API_HOST=https://api-qa.bountysource.com/ -BOUNTYSOURCE_WWW_HOST=https://www-qa.bountysource.com/ +BOUNTYSOURCE_API_HOST=https://staging-qa.bountysource.com +BOUNTYSOURCE_WWW_HOST=https://staging.bountysource.com BOUNTYSOURCE_CALLBACK=http://127.0.0.1:8537/on/bountysource/associate GOOGLE_ANALYTICS_ID= GAUGES_ID= diff --git a/gittip/elsewhere/bountysource.py b/gittip/elsewhere/bountysource.py index 2da88a591a..6449007902 100644 --- a/gittip/elsewhere/bountysource.py +++ b/gittip/elsewhere/bountysource.py @@ -9,8 +9,11 @@ class BountysourceAccount(AccountElsewhere): platform = u'bountysource' def get_url(self): - url = "https://www.bountysource.com/#users/%s" % self.user_info["slug"] - return url + + # I don't see that we actually use this. Leaving as a stub pending + # https://github.com/gittip/www.gittip.com/pull/1369. + + raise NotImplementedError def resolve(login): diff --git a/tests/test_elsewhere_bountysource.py b/tests/test_elsewhere_bountysource.py new file mode 100644 index 0000000000..92f3edd270 --- /dev/null +++ b/tests/test_elsewhere_bountysource.py @@ -0,0 +1,12 @@ +from __future__ import absolute_import, division, print_function, unicode_literals + +from gittip.testing import Harness +from gittip.testing.client import TestClient + + +class Tests(Harness): + + def test_redirect_redirects(self): + self.make_participant('alice') + actual = TestClient().get('/on/bountysource/redirect', user='alice').code + assert actual == 302 diff --git a/www/on/bountysource/redirect.spt b/www/on/bountysource/redirect.spt index 32933f4471..fd758723ee 100644 --- a/www/on/bountysource/redirect.spt +++ b/www/on/bountysource/redirect.spt @@ -21,68 +21,10 @@ connect_params = { 'login': user.participant.username } - -# Collect extra params from accounts elsewhere. -# ============================================= -# The following attributes will be added to connect_params from linked accounts -# if present: email, first_name, last_name, avatar_url. These are used to -# prefill the account creation screen on Bountysource. - -for account in user.participant.get_accounts_elsewhere(): - # Note: returns None for accounts that haven't been linked yet - if account is None: - continue - - # from Github - if account.platform == 'github': - # split single name string into parts - name_parts = re.split('\s+', account.user_info.get('name', '').strip()) - - if not connect_params.get('login'): - connect_params['login'] = account.user_info.get('login') - if not connect_params.get('email'): - connect_params['email'] = account.user_info.get('email') - if not connect_params.get('avatar_url'): - connect_params['avatar_url'] = account.user_info.get('avatar_url') - if not connect_params.get('first_name'): - if len(name_parts) >= 1: - connect_params['first_name'] = name_parts[0] - if not connect_params.get('last_name'): - if len(name_parts) >= 2: - connect_params['last_name'] = name_parts[-1] - - # from Twitter - if account.platform == 'twitter': - # split single name string into parts - name_parts = re.split('/s+', account.user_info.get('name').strip()) - - if not connect_params.get('login'): - connect_params['login'] = account.user_info.get('screen_name') - if not connect_params.get('avatar_url'): - connect_params['avatar_url'] = \ - account.user_info.get('profile_image_url_https') - if not connect_params.get('first_name'): - if name_parts: - connect_params['first_name'] = name_parts[0] - if not connect_params.get('last_name'): - if len(name_parts) >= 2: - connect_params['last_name'] = name_parts[-1] - - # from Bitbucket - if account.platform == 'bitbucket': - if not connect_params.get('login'): - connect_params['login'] = account.user_info.get('username') - if not connect_params.get('avatar_url'): - connect_params['avatar_url'] = account.user_info.get('avatar') - if not connect_params.get('first_name'): - connect_params['first_name'] = account.user_info.get('first_name') - if not connect_params.get('last_name'): - connect_params['last_name'] = account.user_info.get('last_name') - # build redirect URL to Bountysource from collected data -auth_url = "%s#auth/gittip/confirm?%s" % ( bountysource.www_host - , urlencode(connect_params) - ) +auth_url = "{}/auth/gittip/confirm?{}".format( website.bountysource_www_host + , urlencode(connect_params) + ) log("Redirect to Bountysource for authorization: %s" % connect_params) request.redirect(auth_url)