diff --git a/progit/app.py b/progit/app.py index d63943b..5963735 100644 --- a/progit/app.py +++ b/progit/app.py @@ -538,7 +538,7 @@ def edit_issue(repo, issueid, username=None): ) -def request_pulls(repo, username=None): +def request_pulls(repo, username=None, status=True): """ Returns the list of pull-requests opened on a project. """ repo = progit.lib.get_project(SESSION, repo, user=username) @@ -546,8 +546,12 @@ def request_pulls(repo, username=None): if not repo: flask.abort(404, 'Project not found') - requests = progit.lib.get_pull_requests( - SESSION, project_id=repo.id, status=True) + if status is False or str(status).lower() == 'closed': + requests = progit.lib.get_pull_requests( + SESSION, project_id=repo.id, status=False) + else: + requests = progit.lib.get_pull_requests( + SESSION, project_id=repo.id, status=status) return flask.render_template( 'requests.html', @@ -555,6 +559,7 @@ def request_pulls(repo, username=None): repo=repo, username=username, requests=requests, + status=status, ) diff --git a/progit/templates/requests.html b/progit/templates/requests.html index 147b305..0ce81c7 100644 --- a/progit/templates/requests.html +++ b/progit/templates/requests.html @@ -6,7 +6,28 @@ {% block repo %} -

Pull-requests

+
+

+ Pull-requests +

+ {% if status and status not in [False, 'Closed'] %} + {% if '/fork/' in request.url %} + + {% else %} + + {% endif %} + (Closed) + {% else %} + {% if '/fork/' in request.url %} + + {% else %} + + {% endif %} + (Open) + {% endif %} +
{% if requests %} diff --git a/progit/urls.py b/progit/urls.py index 0928281..48b2896 100644 --- a/progit/urls.py +++ b/progit/urls.py @@ -346,14 +346,16 @@ def fork_edit_issue(username, repo, issueid): def request_pulls(repo): """ Request pulling the changes from the fork into the project. """ - return progit.app.request_pulls(repo) + status = flask.request.args.get('status', True) + return progit.app.request_pulls(repo, status=status) @APP.route('/fork///request-pulls') def fork_request_pulls(username, repo): """ Request pulling the changes from the fork into the project. """ - return progit.app.request_pulls(repo, username=username) + status = flask.request.args.get('status', True) + return progit.app.request_pulls(repo, username=username, status=status) @APP.route('//request-pull/')