From 37b3937a39fd07db53ef6a4677932c7084402ac7 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Aug 02 2020 17:30:47 +0000 Subject: Change the project icon when the project is mirrored from an external source This will allow to easily find out if a project's primary location is this pagure instance or elsewhere. Fixes https://pagure.io/pagure/issue/4941 Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/templates/repo_master.html b/pagure/templates/repo_master.html index cf02914..75ed514 100644 --- a/pagure/templates/repo_master.html +++ b/pagure/templates/repo_master.html @@ -36,6 +36,9 @@

{% if repo.is_fork -%} + {% elif repo.mirrored_from -%} + {%- else -%} {%- endif -%} diff --git a/tests/test_pagure_flask_ui_repo_mirrored_from.py b/tests/test_pagure_flask_ui_repo_mirrored_from.py index 2c33053..6cbfc30 100644 --- a/tests/test_pagure_flask_ui_repo_mirrored_from.py +++ b/tests/test_pagure_flask_ui_repo_mirrored_from.py @@ -53,6 +53,29 @@ class PagureUiRepoMirroredFromTests(tests.Modeltests): self.session.add(self.project) self.session.commit() + def test_custom_projecticon(self): + """ Ensure that the customized project icon is shown the main page of + the project. + """ + output = self.app.get("/test") + output_text = output.get_data(as_text=True) + self.assertIn( + '', + output_text, + ) + + def test_regular_projecticon(self): + """ Ensure that the customized project icon is shown the main page of + the project. + """ + output = self.app.get("/test2") + output_text = output.get_data(as_text=True) + self.assertNotIn( + '