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

Commit

Permalink
Back out tip hard sell; #489
Browse files Browse the repository at this point in the history
This is causing difficulties for new developers and isn't getting us
more credit cards. It's too desparate and forceful. That's not the
Gittip way.
  • Loading branch information
chadwhitacre committed Jun 1, 2013
1 parent 08d8303 commit c6304b2
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 118 deletions.
3 changes: 0 additions & 3 deletions gittip/models/participant.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,9 +405,6 @@ def compute_split(self):
def set_tip_to(self, tippee, amount):
return OldParticipant(self.username).set_tip_to(tippee, amount)

def set_up_initial_tips(self, then):
return OldParticipant(self.username).set_up_initial_tips(then)

def insert_into_communities(self, is_member, name, slug):
return OldParticipant(self.username).insert_into_communities( is_member
, name
Expand Down
85 changes: 0 additions & 85 deletions gittip/participant.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,91 +150,6 @@ def set_as_claimed(self):
"""
gittip.db.execute(CLAIM, (self.username,))

@require_username
def set_up_initial_tips(self, then):
"""First-time users get a few tips suggested for them.
The incoming `then` parameter is the URL they would otherwise have been
redirected to. We use it to base our decision on who the initial tips
should be to.
We want a total of $5.00 in tips:
- one to Gittip at $1.00
- four random ones at $0.25
- either:
- one at $3.00 to the participant who's profile they were on
when they signed in
or:
- three random ones at $1.00
The random ones should be taken from all participants with a statement,
or if they signed in from a community page, all participants from that
community with a statement (and they should be added to that community
as well).
"""
initial_tips = []
nothers = 7

their_hero = None
if re.match(r'^/[^/]*/$', then):
their_hero = then[1:-1]
if their_hero != self.username:
initial_tips.append((their_hero, '3.00'))
nothers = 4

if their_hero is None:
# This is a goofy way to turn the where clause in the SQL
# statements below into a no-op when there is no their_hero.
their_hero = 'Gittip'

community_slug = ''
if re.match(r'^/for/[^/]*/$', then):
community_slug = then[5:-1]
community_name = community.slug_to_name(community_slug)
self.insert_into_communities(False, community_name, community_slug)
others = gittip.db.fetchall("""
SELECT participant AS username
FROM current_communities
WHERE slug=%s
AND is_member
AND participant != %s
AND participant != %s
AND participant != 'Gittip'
ORDER BY random()
LIMIT %s
""", (community_slug, self.username, their_hero, nothers))
else:
others = gittip.db.fetchall("""
SELECT username
FROM participants p
JOIN elsewhere e
ON e.participant = p.username
WHERE statement != ''
AND claimed_time IS NOT NULL
AND is_suspicious IS NOT true
AND username != %s
AND username != %s
AND username != 'Gittip'
ORDER BY random()
LIMIT %s
""", (self.username, their_hero, nothers,))

for i, rec in enumerate(others):
amount = '0.25' if i < 4 else '1.00'
initial_tips.append((rec['username'], amount))

# Tip to Gittip goes at the end so it sorts lower on giving page.
initial_tips.append(('Gittip', '1.00'))

for tippee, amount in initial_tips:
amount, first_time_tipper = self.set_tip_to(tippee, amount)

@require_username
def insert_into_communities(self, is_member, name, slug):
username = self.username
Expand Down
15 changes: 5 additions & 10 deletions www/on/bitbucket/associate
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ user_info['html_url'] = "https://bitbucket.org/" + username
log(u"%s wants to %s" % (username, action))

account = bitbucket.BitbucketAccount(username, user_info)
newly_claimed = False

if action == 'opt-in': # opt in
# set 'user' to give them a session :/
Expand Down Expand Up @@ -113,15 +112,11 @@ else: # lock or unlock
assert account.participant != username, username # sanity check
account.set_is_locked(action == 'lock')

if newly_claimed:
user.set_up_initial_tips(then)
then = u'/%s/giving/?first_time=1' % user.username
else:
if then == u'':
then = u'/%s/' % account.participant
if not then.startswith(u'/'):
# Interpret it as a Bitbucket username.
then = u'/on/bitbucket/%s/' % then
if then == u'':
then = u'/%s/' % account.participant
if not then.startswith(u'/'):
# Interpret it as a Bitbucket username.
then = u'/on/bitbucket/%s/' % then
request.redirect(then)

# ========================== ^L text/plain
15 changes: 5 additions & 10 deletions www/on/github/associate
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ if login is None:
log(u"%s wants to %s" % (login, action))

account = github.GitHubAccount(user_info['id'], user_info)
newly_claimed = False

if action == 'opt-in': # opt in
# set 'user' to give them a session :/
Expand Down Expand Up @@ -71,15 +70,11 @@ else: # lock or unlock

account.set_is_locked(action == 'lock')

if newly_claimed:
user.set_up_initial_tips(then)
then = u'/%s/giving/?first_time=1' % user.username
else:
if then == u'':
then = u'/%s/' % account.participant
if not then.startswith(u'/'):
# Interpret it as a GitHub login.
then = u'/on/github/%s/' % then
if then == u'':
then = u'/%s/' % account.participant
if not then.startswith(u'/'):
# Interpret it as a GitHub login.
then = u'/on/github/%s/' % then
request.redirect(then)

# ========================== ^L text/plain
15 changes: 5 additions & 10 deletions www/on/twitter/associate
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ user_info['html_url'] = "https://twitter.com/" + screen_name
log(u"%s wants to %s" % (screen_name, action))

account = twitter.TwitterAccount(user_info['id'], user_info)
newly_claimed = False

if action == 'opt-in': # opt in
# set 'user' to give them a session :/
Expand Down Expand Up @@ -115,15 +114,11 @@ else: # lock or unlock
assert account.participant != screen_name, screen_name # sanity check
account.set_is_locked(action == 'lock')

if newly_claimed:
user.set_up_initial_tips(then)
then = u'/%s/giving/?first_time=1' % user.username
else:
if then == u'':
then = u'/%s/' % account.participant
if not then.startswith(u'/'):
# Interpret it as a Twitter screen_name.
then = u'/on/twitter/%s/' % then
if then == u'':
then = u'/%s/' % account.participant
if not then.startswith(u'/'):
# Interpret it as a Twitter screen_name.
then = u'/on/twitter/%s/' % then
request.redirect(then)

# ========================== ^L text/plain

0 comments on commit c6304b2

Please sign in to comment.