From ea1dcf1a2b65f5984b447b603de8bb7c0c2d350c Mon Sep 17 00:00:00 2001 From: mrowqa Date: Sat, 10 Jun 2017 13:17:03 +0200 Subject: [PATCH] SIO-1367 Allow admin to see author of the question even if it's already been replied Change-Id: I306101ebd7bee015a55bcf91bcc444579ce52cf4 --- .../templates/questions/list_table.html | 10 +++++++++- oioioi/questions/tests.py | 17 +++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/oioioi/questions/templates/questions/list_table.html b/oioioi/questions/templates/questions/list_table.html index 8dfd4f892..da505e162 100644 --- a/oioioi/questions/templates/questions/list_table.html +++ b/oioioi/questions/templates/questions/list_table.html @@ -23,7 +23,15 @@ {% with record.message as msg %} {% url 'message' contest_id=contest.id message_id=record.link_message.id as link %} - {% if not hide_author %}{% full_name msg.author %}{% endif %} + {% if not hide_author %} + + {% if is_admin and msg.top_reference %} + {% full_name msg.top_reference.author %} + {% else %} + {% full_name msg.author %} + {% endif %} + + {% endif %} {% if is_admin %} {{ msg.date }} {% if msg.pub_date %}{{ msg.pub_date }}{% endif %} diff --git a/oioioi/questions/tests.py b/oioioi/questions/tests.py index 5883cee5c..b51b409af 100644 --- a/oioioi/questions/tests.py +++ b/oioioi/questions/tests.py @@ -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()