From 2864325ea50197037b1d023816719d7cd80c8173 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Dec 09 2020 10:44:00 +0000 Subject: [PATCH 1/2] Fix the pagination links in the "My PRs" page We were using the macro but not importing it so when it was actually try to add the pagination, it would raise a 500 error. Similarly, we were not passing to the template the "page" variable so we couldn't pass it to the macro and if we tried we would get another 500 error. Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/templates/userprofile_pullrequests.html b/pagure/templates/userprofile_pullrequests.html index 86606e3..52709a3 100644 --- a/pagure/templates/userprofile_pullrequests.html +++ b/pagure/templates/userprofile_pullrequests.html @@ -2,6 +2,7 @@ {% block title %}Pull Requests for {{ username }}{% endblock %} +{% from "_render_repo.html" import pagination_link %} {% from "_render_pullrequests.html" import render_pullrequest_row %} {% block userprofile_content %} diff --git a/pagure/ui/app.py b/pagure/ui/app.py index a7eec73..4cfbb9d 100644 --- a/pagure/ui/app.py +++ b/pagure/ui/app.py @@ -962,6 +962,7 @@ def view_user_requests(username): select="requests", pr_type=pr_type, pr_status=pr_status, + page=page, total_pages=total_pages, repos_length=userprofile_common["repos_length"], forks_length=userprofile_common["forks_length"], From 821b060b84d95ad157b4820f4976bc3c26415cbc Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Dec 09 2020 10:46:17 +0000 Subject: [PATCH 2/2] Fix showing the number of PR involved Since we used to have all the PRs showing on the page, we were simply counting with JS the number of rows/PRs shown. Now that we paginate we can no longer do this and instead we need to rely on the information we retrieve from the database. Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/templates/userprofile_pullrequests.html b/pagure/templates/userprofile_pullrequests.html index 52709a3..0e09ed7 100644 --- a/pagure/templates/userprofile_pullrequests.html +++ b/pagure/templates/userprofile_pullrequests.html @@ -42,7 +42,7 @@
Pull Requests {{username}} can act on
{% endif %} - PRs + {{ requests_length }} PRs @@ -64,7 +64,4 @@ {{ super() }} - {% endblock %} diff --git a/pagure/ui/app.py b/pagure/ui/app.py index 4cfbb9d..cb5495e 100644 --- a/pagure/ui/app.py +++ b/pagure/ui/app.py @@ -959,6 +959,7 @@ def view_user_requests(username): username=username, user=user, requests=requests, + requests_length=requests_length, select="requests", pr_type=pr_type, pr_status=pr_status,