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

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
issue #4214
Browse files Browse the repository at this point in the history
JessaWitzel authored and chadwhitacre committed Dec 5, 2016

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
1 parent 3332a43 commit af0022e
Showing 6 changed files with 6 additions and 21 deletions.
5 changes: 2 additions & 3 deletions gratipay/models/team/__init__.py
Original file line number Diff line number Diff line change
@@ -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)
@@ -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
}


6 changes: 2 additions & 4 deletions gratipay/testing/harness.py
Original file line number Diff line number Diff line change
@@ -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)
@@ -321,5 +321,3 @@ def get_tip(self, tipper, tippee):
LIMIT 1
""", (tipper, tippee), back_as=dict, default=default)['amount']


6 changes: 1 addition & 5 deletions tests/py/test_team_edit.py
Original file line number Diff line number Diff line change
@@ -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'
@@ -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):
@@ -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):
@@ -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)

@@ -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'
3 changes: 1 addition & 2 deletions www/%team/edit/edit.json.spt
Original file line number Diff line number Diff line change
@@ -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:
@@ -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."
3 changes: 0 additions & 3 deletions www/%team/edit/index.html.spt
Original file line number Diff line number Diff line change
@@ -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>
4 changes: 0 additions & 4 deletions www/%team/index.html.spt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit af0022e

Please sign in to comment.