Skip to content

Commit 02d8075

Browse files
committed
Restores add-to-community-list functionality to several pages. Fixes ietf-tools#1601. Commit ready for merge.
- Legacy-Id: 9242
1 parent 0584ccc commit 02d8075

3 files changed

Lines changed: 8 additions & 11 deletions

File tree

ietf/doc/views_search.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -404,12 +404,6 @@ def search(request):
404404

405405
# Determine whether each document is being tracked or not, and remember
406406
# that so we can display the proper track/untrack option.
407-
# We use a slightly cumbersome pair of dictionaries:
408-
# - have_doc_status is set if we know anything about the document at all
409-
# - doc_is_tracked is set if we are tracking the document
410-
# If have_doc_status is False, then we use an empty cell, otherwise
411-
# we either use the track or untrack option in the cell, as appropriate.
412-
have_doc_status = { }
413407
doc_is_tracked = { }
414408
if request.user.is_authenticated():
415409
try:
@@ -420,10 +414,9 @@ def search(request):
420414
for doc in results:
421415
if clist.get_documents().filter(name=doc.name).count() > 0:
422416
doc_is_tracked[doc.name] = True
423-
have_doc_status[doc.name] = True
424417

425418
return render_to_response('doc/search/search.html',
426-
{'form':form, 'docs':results, 'have_doc_status':have_doc_status, 'doc_is_tracked':doc_is_tracked, 'meta':meta, },
419+
{'form':form, 'docs':results, 'doc_is_tracked':doc_is_tracked, 'meta':meta, },
427420
context_instance=RequestContext(request))
428421

429422
def frontpage(request):

ietf/group/tests_info.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,12 @@ def test_group_documents(self):
163163

164164
self.assertTrue(draft2.name in r.content)
165165

166+
# Make sure that a logged in user is presented with an opportunity to add results to their community list
167+
self.client.login(username="secretary", password="secretary+password")
168+
r = self.client.get(url)
169+
q = PyQuery(r.content)
170+
self.assertTrue(any([draft2.name in x.attrib['href'] for x in q('table.ietf-doctable td.addtolist a')]))
171+
166172
# test the txt version too while we're at it
167173
url = urlreverse('ietf.group.info.group_documents_txt', kwargs=dict(group_type=group.type_id, acronym=group.acronym))
168174
r = self.client.get(url)

ietf/templates/doc/search/search_result_row.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@
3535
{% load ietf_filters %}
3636
<tr class="{{ forloop.counter|divisibleby:2|yesno:"oddrow,evenrow" }}">
3737
{% if user.is_authenticated %}
38-
{% if not doc.name in have_doc_status %}
39-
<td>&nbsp;</td>
40-
{% elif doc.name in doc_is_tracked %}
38+
{% if doc.name in doc_is_tracked %}
4139
<td class="removefromlist">
4240
<a href="{% url "community_remove_track_document" doc.name %}" title="Remove from your personal ID list"><img src="/images/remove_from_list.png" alt="Remove from your personal ID list" /></a>
4341
</td>

0 commit comments

Comments
 (0)