From ad1526fee99f05e8a90f33912552d73fd2f54569 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Dec 04 2018 12:30:52 +0000 Subject: Show related PRs on the issue list if there are any If there is only one, link directly to it, otherwise indicate to how many PRs this ticket is related to. Fixes https://pagure.io/pagure/issue/3742 Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/templates/_render_issues.html b/pagure/templates/_render_issues.html index 69e27d4..1a4f803 100644 --- a/pagure/templates/_render_issues.html +++ b/pagure/templates/_render_issues.html @@ -102,7 +102,7 @@ namespace=repo.namespace) }}"> {% endif %} - + {{ repo.name }} {% endif %} @@ -165,6 +165,22 @@ {% endif %} {% endif %} + {% if issue.related_prs | length == 1 %} + + + PR#{{ issue.related_prs[0].id }} + + {% elif issue.related_prs | length > 1 %} + + + + {% endif %} + {% endif %} diff --git a/tests/test_pagure_flask_ui_issue_pr_link.py b/tests/test_pagure_flask_ui_issue_pr_link.py index a6fc8f4..d70dc59 100644 --- a/tests/test_pagure_flask_ui_issue_pr_link.py +++ b/tests/test_pagure_flask_ui_issue_pr_link.py @@ -153,6 +153,19 @@ class PagureFlaskPrIssueLinkTest(tests.Modeltests): 'Related Pull Requests', output.get_data(as_text=True)) + def test_pr_link_issue_list(self): + """ Test that the related PR(s) shows in the page listing issues + """ + output = self.app.get('/test/issues') + self.assertEqual(output.status_code, 200) + self.assertIn( + '\n' + ' \n' + ' PR#3\n ', + output.get_data(as_text=True)) + if __name__ == '__main__': unittest.main(verbosity=2)