From 16db8367c1512aea22935bc5b9077264ae2b7d2a Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Oct 09 2017 14:44:09 +0000 Subject: Include the PRs opened by the user on the 'My pull-requests' page Fixes https://pagure.io/pagure/issue/2662 Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/lib/__init__.py b/pagure/lib/__init__.py index 36a3d28..33fdef9 100644 --- a/pagure/lib/__init__.py +++ b/pagure/lib/__init__.py @@ -3583,8 +3583,17 @@ def get_pull_request_of_user(session, username): ) ) ) + sub_q5 = session.query( + model.Project.id + ).filter( + sqlalchemy.and_( + model.Project.id == model.PullRequest.project_id, + model.PullRequest.user_id == model.User.id, + model.User.user == username + ) + ) - projects = projects.union(sub_q2).union(sub_q3).union(sub_q4) + projects = projects.union(sub_q2).union(sub_q3).union(sub_q4).union(sub_q5) query = session.query( model.PullRequest diff --git a/tests/test_pagure_flask_ui_app.py b/tests/test_pagure_flask_ui_app.py index 70faf68..eb5729b 100644 --- a/tests/test_pagure_flask_ui_app.py +++ b/tests/test_pagure_flask_ui_app.py @@ -1310,6 +1310,37 @@ class PagureFlaskApptests(tests.Modeltests): output.data.count('