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

Commit

Permalink
issue #4214
Browse files Browse the repository at this point in the history
  • Loading branch information
JessaWitzel authored and chadwhitacre committed Dec 6, 2016
1 parent ed2a7f3 commit 6b357c8
Show file tree
Hide file tree
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
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']


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
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

0 comments on commit 6b357c8

Please sign in to comment.