Skip to content

Commit

Permalink
SIO-1367 Allow admin to see author of the question even if it's alrea…
Browse files Browse the repository at this point in the history
…dy been replied

Change-Id: I306101ebd7bee015a55bcf91bcc444579ce52cf4
  • Loading branch information
mrowqa committed Jun 13, 2017
1 parent aa0fd01 commit ea1dcf1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
10 changes: 9 additions & 1 deletion oioioi/questions/templates/questions/list_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,15 @@
{% with record.message as msg %}
{% url 'message' contest_id=contest.id message_id=record.link_message.id as link %}
<tr class="{% if record.needs_reply %}danger{% elif is_admin and msg.kind == 'PUBLIC' %}info{% endif %}">
{% if not hide_author %}<td>{% full_name msg.author %}</td>{% endif %}
{% if not hide_author %}
<td>
{% if is_admin and msg.top_reference %}
{% full_name msg.top_reference.author %}
{% else %}
{% full_name msg.author %}
{% endif %}
</td>
{% endif %}
{% if is_admin %}
<td><a href="{{ link }}">{{ msg.date }}</a></td>
<td>{% if msg.pub_date %}<a href="{{ link }}">{{ msg.pub_date }}</a>{% endif %}</td>
Expand Down
17 changes: 17 additions & 0 deletions oioioi/questions/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,23 @@ def test_filtering(self):
self.assertNotIn('public-answer', response.content)
self.assertIn('private-answer', response.content)

def test_author_column(self):
contest = Contest.objects.get()
url = reverse('contest_messages',
kwargs={'contest_id': contest.id})

self.client.login(username='test_admin')
response = self.client.get(url)
self.assertEquals(200, response.status_code)
self.assertContains(response, 'Test Admin', 3)
self.assertContains(response, 'Test User', 3)

self.client.login(username='test_user')
response = self.client.get(url)
self.assertEquals(200, response.status_code)
self.assertContains(response, 'Test Admin', 5)
self.assertContains(response, 'Test User', 1)

def test_authors_list(self):
self.client.login(username='test_admin')
contest = Contest.objects.get()
Expand Down

0 comments on commit ea1dcf1

Please sign in to comment.