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

Commit

Permalink
collection owner cannot add himself as contributor to his own collect…
Browse files Browse the repository at this point in the history
…ion (bug 592857)
  • Loading branch information
vaidik authored and cvan committed Jan 9, 2012
1 parent 16d2708 commit 823bb44
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion apps/bandwagon/templates/bandwagon/edit_contributors.html
Expand Up @@ -47,7 +47,7 @@ <h3>{{ _('Collection Contributors') }}</h3>
<tr>
<td colspan="4" class="input">
<input id="contributor-ac" class="long placeholder" data-src="{{ url('users.ajax') }}"
data-owner="{{ collection.owner_id }}"
data-owner="{{ collection.author_id }}"
placeholder="{{ _('Enter the email address of the contributor to add') }}" />
<button id="contributor-ac-button">
{{ _('Add Contributor') }}
Expand Down
7 changes: 7 additions & 0 deletions apps/bandwagon/tests/test_views.py
Expand Up @@ -410,6 +410,13 @@ def test_edit(self):
r = self.client.get(url, follow=True)
eq_(r.status_code, 200)

def test_edit_contributors_form(self):
self.create_collection()
url = reverse('collections.edit', args=['admin', self.slug])
r = self.client.get(url, follow=True)
eq_(Collection.objects.get(slug=self.slug).author_id,
long(pq(r.content)('#contributor-ac').attr('data-owner')))

def test_edit_breadcrumbs(self):
c = Collection.objects.all()[0]
r = self.client.get(reverse('collections.edit',
Expand Down
2 changes: 2 additions & 0 deletions media/js/zamboni/collections.js
Expand Up @@ -490,6 +490,8 @@ if ($('body.collections-contributors')) {
$('#contributor-ac-button').closest('tbody').append(str);

$contributor_error.html('').removeClass('error');
} else if (d.id == my_id) {
$contributor_error.html(gettext('You cannot add yourself as a contributor.')).addClass('error');
} else {
$contributor_error.html(gettext('You have already added that user.')).addClass('error');
}
Expand Down

0 comments on commit 823bb44

Please sign in to comment.