Commit 4a2cf2b Make links rely on repo.is_fork to determine if an user should be specified or not

4 files Authored and Committed by pingou 7 days ago
Make links rely on repo.is_fork to determine if an user should be specified or not

Fixes https://pagure.io/pagure/issue/3312

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>

    
 1 @@ -14,7 +14,7 @@
 2                       <span class="font-weight-bold">
 3                           <a class="notblue" href="{{ url_for('ui_ns.view_issue',
 4                           repo=repo.name,
 5 -                         username=username,
 6 +                         username=repo.username if repo.is_fork else None,
 7                           namespace=repo.namespace,
 8                           issueid=issue.id) }}">
 9                           {{issue.title}}
10 @@ -39,7 +39,7 @@
11                                     class="badge badge-secondary"
12                                     href="{{ url_for('ui_ns.view_issues',
13                                         repo=repo.name,
14 -                                       username=username,
15 +                                       username=repo.username if repo.is_fork else None,
16                                         namespace=repo.namespace,
17                                         tags=tag.tag) }}">
18                                   {{ tag.tag }}
19 @@ -68,4 +68,4 @@
20               </span>
21           </div>
22       </div>
23 - {% endmacro%} 
24 \ No newline at end of file
25 + {% endmacro%}
 1 @@ -35,7 +35,7 @@
 2                               %}btn-primary{% else %}btn-outline-primary{% endif %}"
 3                                  href="{{ url_for('ui_ns.view_roadmap',
 4                                        repo=repo.name,
 5 -                                      username=username,
 6 +                                      username=repo.username if repo.is_fork else None,
 7                                        namespace=repo.namespace,
 8                                       status='active') }}">
 9                                   <i class="fa fa-clock-o"></i>
10 @@ -45,7 +45,7 @@
11                               %}btn-primary{% else %}btn-outline-primary{% endif %}"
12                                  href="{{ url_for('ui_ns.view_roadmap',
13                                        repo=repo.name,
14 -                                      username=username,
15 +                                      username=repo.username if repo.is_fork else None,
16                                        namespace=repo.namespace,
17                                       status='inactive') }}">
18                                   <i class="fa fa-check-circle"></i>
19 @@ -60,7 +60,7 @@
20               <a href="{{ url_for(
21                   'ui_ns.view_milestone',
22                   repo=repo.name,
23 -                 username=username,
24 +                 username=repo.username if repo.is_fork else None,
25                   namespace=repo.namespace,
26                   milestone=milestone) }}"
27                   class="list-group-item list-group-item-action">
 1 @@ -15,7 +15,7 @@
 2       <h4 class="font-weight-bold">
 3         <div class="row">
 4           <div class="col">
 5 -            {{ title }} 
 6 +            {{ title }}
 7             <span class="badge badge-secondary">{{ issues | length }} issues</span>
 8           </div>
 9         {% if milestone and milestone in repo.milestones and repo.milestones[milestone]['date'] %}
10 @@ -58,7 +58,7 @@
11                 <a {% if issue.status == 'Closed' %}class="text-muted"{% endif %} href="{{ url_for(
12                     'ui_ns.view_issue',
13                     repo=repo.name,
14 -                   username=username,
15 +                   username=repo.username if repo.is_fork else None,
16                     namespace=repo.namespace,
17                     issueid=issue.id) }}">
18                   {{ issue.title | noJS("img") | safe }}
19 @@ -139,7 +139,7 @@
20         <a href="{{ url_for(
21               'ui_ns.view_settings',
22               repo=repo.name,
23 -             username=username,
24 +             username=repo.username if repo.is_fork else None,
25               namespace=repo.namespace) }}#roadmap-tab"
26             class="btn btn-outline-primary">
27             <i class="fa fa-cogs fa-fw"></i>
28 @@ -159,7 +159,7 @@
29         else %}btn-outline-primary{%
30         endif %} btn-sm" href="{{ url_for('ui_ns.view_roadmap',
31           repo=repo.name,
32 -         username=username,
33 +         username=repo.username if repo.is_fork else None,
34           namespace=repo.namespace,
35           milestone=requested_stones,
36           all_stones=all_stones,
37 @@ -169,7 +169,7 @@
38         else %}btn-outline-primary{%
39         endif %} btn-sm" href="{{ url_for('ui_ns.view_roadmap',
40           repo=repo.name,
41 -         username=username,
42 +         username=repo.username if repo.is_fork else None,
43           namespace=repo.namespace,
44           tag=tags,
45           milestone=requested_stones,
46 @@ -180,7 +180,7 @@
47         else %}btn-outline-primary{%
48         endif %} btn-sm" href="{{ url_for('ui_ns.view_roadmap',
49           repo=repo.name,
50 -         username=username,
51 +         username=repo.username if repo.is_fork else None,
52           namespace=repo.namespace,
53           tag=tags,
54           milestone=requested_stones,
55 @@ -194,7 +194,7 @@
56         else %}btn-outline-primary{%
57         endif %} btn-sm" href="{{ url_for('ui_ns.view_roadmap',
58           repo=repo.name,
59 -         username=username,
60 +         username=repo.username if repo.is_fork else None,
61           namespace=repo.namespace,
62           tag=tags,
63           status=status) }}" title="Only display active milestone tags">Active Milestones</a>
64 @@ -203,7 +203,7 @@
65         else %}btn-outline-primary{%
66         endif %} btn-sm" href="{{ url_for('ui_ns.view_roadmap',
67           repo=repo.name,
68 -         username=username,
69 +         username=repo.username if repo.is_fork else None,
70           namespace=repo.namespace,
71           tag=tags,
72           all_stones=true,
73 @@ -213,7 +213,7 @@
74         else %}btn-outline-primary{%
75         endif %} btn-sm" href="{{ url_for('ui_ns.view_roadmap',
76           repo=repo.name,
77 -         username=username,
78 +         username=repo.username if repo.is_fork else None,
79           namespace=repo.namespace,
80           tag=tags,
81           no_stones=true,
82 @@ -228,7 +228,7 @@
83           href="{{ url_for(
84             'ui_ns.view_roadmap',
85             repo=repo.name,
86 -           username=username,
87 +           username=repo.username if repo.is_fork else None,
88             namespace=repo.namespace,
89             milestone=stone | add_or_remove(requested_stones[:]),
90             tag=tags,
91 @@ -246,7 +246,7 @@
92           <a class="btn btn-outline-primary btn-sm {% if tag in tags %}active{% endif %}"
93             href="{{ url_for('ui_ns.view_roadmap',
94                 repo=repo.name,
95 -               username=username,
96 +               username=repo.username if repo.is_fork else None,
97                 namespace=repo.namespace,
98                 status=status,
99                 tag=tag | add_or_remove(tags[:]),
 1 @@ -570,6 +570,11 @@
 2           self.assertIn(
 3               '<span class="fa fa-fw fa-exclamation-circle"></span> 0 Closed\n',
 4               output_text)
 5 +         self.assertIn(
 6 +             '<a class="notblue" href="/test/issue/2">', output_text)
 7 +         self.assertEquals(
 8 +             output_text.count('<a class="notblue" href="/test/issue/2">'),
 9 +             1)
10   
11           # test the roadmap view for errors
12           output = self.app.get('/foo/roadmap')