From 0482732b26c6e0c02163cf5b28887b92b4c8fd39 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Dec 01 2017 14:21:38 +0000 Subject: Fix displaying the filename on the side and linking to file for remote PRs Fixes https://pagure.io/pagure/issue/2786 Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/templates/pull_request.html b/pagure/templates/pull_request.html index d6ef1fe..4d6986c 100644 --- a/pagure/templates/pull_request.html +++ b/pagure/templates/pull_request.html @@ -390,34 +390,42 @@ {%endmacro%} {% macro viewfilelink(filepath, identifier=False)%} - {% if pull_request %} - {% if not identifier %} - {% set identifier = pull_request.branch_from %} + {% if pull_request and not pull_request.remote %} + {% if not identifier %} + {% set identifier = pull_request.branch_from %} + {% endif %} + {{ + filepath | unicode }} + {% elif not pull_request %} + {% if identifier == False %} + {% set identifier = branch_from %} + {% endif %} + {{ + filepath | unicode }} + {% elif pull_request and pull_request.remote %} + this is a remote pull-request, so we cannot provide you + with a direct link to the file but you can always + + checkout the pull-request locally + to review it entirely. {% endif %} - {{ - filepath | unicode }} {% endmacro %} {% if patch | hasattr('new_file_path') %} @@ -877,11 +885,14 @@ {%- endif -%} {%- elif patch | hasattr('delta') -%} {%- if patch.delta.new_file.path == patch.delta.old_file.path -%} - {%- if patch.delta.new_file.mode == 0 and patch.delta.old_file.mode == 33188 -%} + {%- if patch.delta.new_file.mode == 0 + and patch.delta.old_file.mode in [33188, 33261] -%} {{ changesdeletedfile(patch.delta.new_file.path, linesadded, linesremoved, count) }} - {%-elif patch.delta.new_file.mode == 33188 and patch.delta.old_file.mode == 0 -%} + {%-elif patch.delta.new_file.mode in [33188, 33261] + and patch.delta.old_file.mode == 0 -%} {{ changesaddedfile(patch.delta.new_file.path, linesadded, linesremoved, count) }} - {%-elif patch.delta.new_file.mode == 33188 and patch.delta.old_file.mode == 33188 -%} + {%-elif patch.delta.new_file.mode in [33188, 33261] + and patch.delta.old_file.mode in [33188, 33261] -%} {{ changeschangedfile(patch.delta.new_file.path, linesadded, linesremoved, count) }} {%-endif-%} {%- else -%}