From d1f43e3a6665639e5fcbaa16922ec2e856d62238 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Oct 31 2017 10:21:35 +0000 Subject: Show the reply button even if the PR/issue is closed. Fixes https://pagure.io/pagure/issue/2724 Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/templates/_formhelper.html b/pagure/templates/_formhelper.html index ee8274d..55f3443 100644 --- a/pagure/templates/_formhelper.html +++ b/pagure/templates/_formhelper.html @@ -139,7 +139,7 @@ {% endif %}
- {% if id != 0 and g.fas_user and comment.parent.status in [True, 'Open'] %} + {% if id != 0 and g.fas_user %} diff --git a/tests/test_pagure_flask_ui_issues.py b/tests/test_pagure_flask_ui_issues.py index f812be6..2ff9d44 100644 --- a/tests/test_pagure_flask_ui_issues.py +++ b/tests/test_pagure_flask_ui_issues.py @@ -3328,6 +3328,76 @@ class PagureFlaskIssuestests(tests.Modeltests): '

foo bar #1 see?

', output.data) + @patch('pagure.lib.git.update_git') + @patch('pagure.lib.notify.send_email') + def test_view_issue_closed(self, p_send_email, p_ugt): + """ Test viewing a closed issue. """ + p_send_email.return_value = True + p_ugt.return_value = True + + tests.create_projects(self.session) + tests.create_projects_git( + os.path.join(self.path, 'repos'), bare=True) + + # Create issues to play with + repo = pagure.get_authorized_project(self.session, 'test') + msg = pagure.lib.new_issue( + session=self.session, + repo=repo, + title='Test issue', + content='We should work on this', + user='pingou', + ticketfolder=None + ) + self.session.commit() + self.assertEqual(msg.title, 'Test issue') + + user = tests.FakeUser() + user.username = 'pingou' + with tests.user_set(pagure.APP, user): + output = self.app.get('/test/issue/1') + self.assertEqual(output.status_code, 200) + self.assertIn( + 'Issue #1: Test issue - test - Pagure', + output.data) + self.assertIn( + '', + output.data) + + csrf_token = self.get_csrf(output=output) + + # Add new comment + data = { + 'csrf_token': csrf_token, + 'status': 'Closed', + 'close_status': 'Fixed', + 'comment': 'Woohoo a second comment !', + } + output = self.app.post( + '/test/issue/1/update', data=data, follow_redirects=True) + self.assertEqual(output.status_code, 200) + self.assertIn( + 'Issue #1: Test issue - test - Pagure', + output.data) + self.assertIn( + '', + output.data) + self.assertIn( + '\n Comment added', + output.data) + self.assertTrue( + '

Woohoo a second comment !

' in output.data) + self.assertEqual(output.data.count('comment_body">'), 2) + self.assertTrue( + '' + in output.data) + self.assertEqual( + output.data.count( + 'title="Reply to this comment - lose formatting">', + ), 1) + if __name__ == '__main__': unittest.main(verbosity=2)