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

Commit

Permalink
Remove the To-do URL (#4214)
Browse files Browse the repository at this point in the history
  • Loading branch information
chadwhitacre committed Dec 8, 2016
1 parent 7665606 commit ab63da0
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 38 deletions.
9 changes: 4 additions & 5 deletions gratipay/models/team/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ def insert(cls, owner, **fields):
INSERT INTO teams
(slug, slug_lower, name, homepage,
product_or_service, todo_url, onboarding_url,
product_or_service, onboarding_url,
owner)
VALUES (%(slug)s, %(slug_lower)s, %(name)s, %(homepage)s,
%(product_or_service)s, %(todo_url)s, %(onboarding_url)s,
%(product_or_service)s, %(onboarding_url)s,
%(owner)s)
RETURNING teams.*::teams
Expand Down Expand Up @@ -170,7 +170,7 @@ def get_payment_distribution(self):

def update(self, **kw):
updateable = frozenset(['name', 'product_or_service', 'homepage',
'onboarding_url', 'todo_url'])
'onboarding_url'])

cols, vals = zip(*kw.items())
assert set(cols).issubset(updateable)
Expand Down Expand Up @@ -320,8 +320,7 @@ def to_dict(self):
'owner': '~' + self.owner,
'receiving': self.receiving,
'slug': self.slug,
'status': self.status,
'todo_url': self.todo_url
'status': self.status
}


Expand Down
6 changes: 2 additions & 4 deletions gratipay/testing/harness.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,10 @@ def make_team(self, *a, **kw):

team = self.db.one("""
INSERT INTO teams
(slug, slug_lower, name, homepage, product_or_service, todo_url,
(slug, slug_lower, name, homepage, product_or_service,
onboarding_url, owner, is_approved, available)
VALUES (%(slug)s, %(slug_lower)s, %(name)s, %(homepage)s, %(product_or_service)s,
%(todo_url)s, %(onboarding_url)s, %(owner)s, %(is_approved)s,
%(onboarding_url)s, %(owner)s, %(is_approved)s,
%(available)s)
RETURNING teams.*::teams
""", _kw)
Expand Down Expand Up @@ -321,5 +321,3 @@ def get_tip(self, tipper, tippee):
LIMIT 1
""", (tipper, tippee), back_as=dict, default=default)['amount']


2 changes: 1 addition & 1 deletion gratipay/utils/fake_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ def fake_team(db, teamowner, teamname=None):
teamname = faker.first_name() + fake_text_id(3)

ctime = teamowner.ctime + datetime.timedelta(days=7)

try:
teamslug = slugize(teamname)
homepage = 'http://www.example.org/' + fake_text_id(3)
Expand All @@ -153,7 +154,6 @@ def fake_team(db, teamowner, teamname=None):
, homepage=homepage
, ctime=ctime
, product_or_service=random.sample(productorservice,1)[0]
, todo_url=homepage + '/tickets'
, onboarding_url=homepage + '/contributing'
, owner=teamowner.username
, is_approved=random.sample(isapproved,1)[0]
Expand Down
5 changes: 5 additions & 0 deletions sql/branch.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
--https://github.com/gratipay/gratipay.com/pull/4214

BEGIN;
ALTER TABLE teams DROP COLUMN todo_url;
END;
6 changes: 1 addition & 5 deletions tests/py/test_team_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ def test_edit(self):
'product_or_service': 'We save galaxies.',
'homepage': 'http://starwars-enterprise.com/',
'onboarding_url': 'http://starwars-enterprise.com/onboarding',
'todo_url': 'http://starwars-enterprise.com/todos',
'image': FileUpload(IMAGE, 'logo.png'),
}
data = json.loads(self.client.POST( '/enterprise/edit/edit.json'
Expand All @@ -256,7 +255,6 @@ def test_edit(self):
assert team.product_or_service == 'We save galaxies.'
assert team.homepage == 'http://starwars-enterprise.com/'
assert team.onboarding_url == 'http://starwars-enterprise.com/onboarding'
assert team.todo_url == 'http://starwars-enterprise.com/todos'
assert team.load_image('original') == IMAGE

def test_edit_supports_partial_updates(self):
Expand All @@ -275,7 +273,6 @@ def test_edit_supports_partial_updates(self):
assert team.product_or_service == 'We save galaxies.'
assert team.homepage == 'http://starwars-enterprise.com/'
assert team.onboarding_url == ''
assert team.todo_url == ''
assert team.load_image('original') == IMAGE

def test_edit_needs_auth(self):
Expand Down Expand Up @@ -332,7 +329,7 @@ def test_can_edit_teams_under_review(self):

def test_can_only_edit_allowed_fields(self):
allowed_fields = set(['name', 'image', 'product_or_service',
'homepage', 'onboarding_url', 'todo_url'])
'homepage', 'onboarding_url'])

team = self.make_team(slug='enterprise', is_approved=None)

Expand Down Expand Up @@ -398,7 +395,6 @@ def test_edit_with_empty_data_does_nothing(self):
'product_or_service': 'We save galaxies.',
'homepage': 'http://starwars-enterprise.com/',
'onboarding_url': 'http://starwars-enterprise.com/onboarding',
'todo_url': 'http://starwars-enterprise.com/todos',
}
self.make_team(**team_data)
r = self.client.POST( '/enterprise/edit/edit.json'
Expand Down
9 changes: 1 addition & 8 deletions tests/py/test_teams.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ class TestTeams(Harness):
'product_or_service': 'We make widgets.',
'homepage': 'http://gratipay.com/',
'onboarding_url': 'http://inside.gratipay.com/',
'todo_url': 'https://github.com/gratipay',
'agree_public': 'true',
'agree_payroll': 'true',
'agree_terms': 'true',
Expand Down Expand Up @@ -227,12 +226,10 @@ def test_casing_of_urls_survives(self):
self.post_new(dict( self.valid_data
, homepage='Http://gratipay.com/'
, onboarding_url='http://INSIDE.GRATipay.com/'
, todo_url='hTTPS://github.com/GRATIPAY'
))
team = T('gratiteam')
assert team.homepage == 'Http://gratipay.com/'
assert team.onboarding_url == 'http://INSIDE.GRATipay.com/'
assert team.todo_url == 'hTTPS://github.com/GRATIPAY'

def test_casing_of_slug_survives(self):
self.make_participant('alice', claimed_time='now', email_address='', last_paypal_result='')
Expand Down Expand Up @@ -301,9 +298,6 @@ def test_error_message_for_bad_url(self):
r = self.post_new(dict(self.valid_data, onboarding_url='foo'), expected=400)
assert "an http[s]:// URL for the 'Self-onboarding Documentation URL' field." in r.body

r = self.post_new(dict(self.valid_data, todo_url='foo'), expected=400)
assert "Please enter an http[s]:// URL for the 'To-do URL' field." in r.body

def test_error_message_for_invalid_team_name(self):
self.make_participant('alice', claimed_time='now', email_address='[email protected]', last_paypal_result='')
data = dict(self.valid_data)
Expand Down Expand Up @@ -451,7 +445,6 @@ def test_update_works(self):
'product_or_service': 'We save galaxies.',
'homepage': 'http://starwars-enterprise.com/',
'onboarding_url': 'http://starwars-enterprise.com/onboarding',
'todo_url': 'http://starwars-enterprise.com/todos',
}
team.update(**update_data)
team = T('enterprise')
Expand All @@ -460,7 +453,7 @@ def test_update_works(self):

def test_can_only_update_allowed_fields(self):
allowed_fields = set(['name', 'product_or_service', 'homepage',
'onboarding_url', 'todo_url'])
'onboarding_url',])

team = self.make_team(slug='enterprise')

Expand Down
3 changes: 1 addition & 2 deletions www/%team/edit/edit.json.spt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ field_names = {
'product_or_service': 'Product or Service',
'homepage': 'Homepage',
'onboarding_url': 'Self-onboarding Documentation URL',
'todo_url': 'To-do URL',
}

if user.ANON:
Expand Down Expand Up @@ -54,7 +53,7 @@ for field in data.keys():
if not value:
raise Response(400, _("Please fill out the '{}' field.", field_names[field]))

if (field in ('homepage', 'onboarding_url', 'todo_url')
if (field in ('homepage', 'onboarding_url')
and not valid_url(value)):
raise Response(400,
_( "Please enter an http[s]:// URL for the '{}' field."
Expand Down
3 changes: 0 additions & 3 deletions www/%team/edit/index.html.spt
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ suppress_sidebar = True
<label><h2>{{ _("Self-onboarding Documentation URL") }}</h2></label>
<input type="text" name="onboarding_url" value="{{team.onboarding_url}}" required>

<label><h2>{{ _("To-do URL") }}</h2></label>
<input type="text" name="todo_url" value="{{team.todo_url}}" required>

<br>
<br>
<button type="submit">{{ _("Modify") }}</button>
Expand Down
4 changes: 0 additions & 4 deletions www/%team/index.html.spt
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ is_team_owner = not user.ANON and team.owner == user.participant.username
| <a href="{{ team.onboarding_url }}">{{ _("Onboarding") }}</a>
{% endif %}

{% if team.todo_url %}
| <a href="{{ team.todo_url }}">{{ _("To-do") }}</a>
{% endif %}

{% if user.ADMIN or is_team_owner %}
|{{ _( "{a} Edit team {_a}"
, a='<a href="./edit">'|safe
Expand Down
4 changes: 0 additions & 4 deletions www/new.spt
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ suppress_sidebar = True
) }}</i></p>
<input type="text" name="onboarding_url" required>

<label><h2>{{ _("To-do URL") }}</h2></label>
<p><i>{{ _("Where can people find a list of available work to do for your Team?") }}</i></p>
<input type="text" name="todo_url" required>

<h2>{{ _("Agreements") }}</h2>
<input type="checkbox" value="true" name="agree_public" id="agree_public">
<label for="agree_public">
Expand Down
3 changes: 1 addition & 2 deletions www/teams/create.json.spt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ field_names = {
'product_or_service': 'Product or Service',
'homepage': 'Homepage',
'onboarding_url': 'Self-onboarding Documentation URL',
'todo_url': 'To-do URL',
}

if user.ANON:
Expand Down Expand Up @@ -64,7 +63,7 @@ if request.method == 'POST':
raise Response(400, _("Please fill out the '{}' field.", field_names[field]))
fields[field] = value

for field in ('homepage', 'onboarding_url', 'todo_url'):
for field in ('homepage', 'onboarding_url'):
if not any(map(fields[field].lower().startswith, ('http://', 'https://'))):
raise Response(400, _( "Please enter an http[s]:// URL for the '{}' field."
, field_names[field]
Expand Down

0 comments on commit ab63da0

Please sign in to comment.