[PATCH 3 of 3] my pullrequests: line up internal handling with repository pullrequests
Thomas De Schampheleire
patrickdepinguin at gmail.com
Sun Feb 22 11:45:06 EST 2015
On February 21, 2015 10:48:15 PM CET, Thomas De Schampheleire <patrickdepinguin at gmail.com> wrote:
># HG changeset patch
># User Thomas De Schampheleire
><thomas.de_schampheleire at alcatel-lucent.com>
># Date 1424554186 -3600
># Sat Feb 21 22:29:46 2015 +0100
># Node ID 8ed5da3e4184defac92036cd8f19aa7cb61ba0fb
># Parent 0728fc3662d27756523ae0d03b91caffb1587ad9
>my pullrequests: line up internal handling with repository pullrequests
>
>Currently, the data for 'my pullrequests' are loaded dynamically
>through
>ajax, unlike the way 'repository pullrequests' are loaded (statically).
>
>As there is no good reason to have both treated differently, and as
>dynamic
>loading of 'my pullrequests' is not really needed, rework the handling
>of
>the 'my pullrequests' page with the 'repository pullrequests' page.
>
>diff --git a/kallithea/config/routing.py b/kallithea/config/routing.py
>--- a/kallithea/config/routing.py
>+++ b/kallithea/config/routing.py
>@@ -729,10 +729,6 @@
> '/my_pullrequests',
> controller='pullrequests',
> action='show_my', conditions=dict(method=["GET"]))
>- rmap.connect('my_pullrequests_data',
>- '/my_pullrequests_data',
>- controller='pullrequests',
>- action='show_my_data',
>conditions=dict(method=["GET"]))
>
> rmap.connect('pullrequest_comment',
> '/{repo_name:.*?}/pull-request-comment/{pull_request_id}',
>diff --git a/kallithea/controllers/pullrequests.py
>b/kallithea/controllers/pullrequests.py
>--- a/kallithea/controllers/pullrequests.py
>+++ b/kallithea/controllers/pullrequests.py
>@@ -207,17 +207,12 @@
> return render('/pullrequests/pullrequest_show_all.html')
>
> @LoginRequired()
>- def show_my(self): # my_account_my_pullrequests
>- c.show_closed = request.GET.get('pr_show_closed')
>- return render('/pullrequests/pullrequest_show_my.html')
>-
>- @NotAnonymous()
This @NotAnonymous should move to the show_my method now. This will presumably also solve the issue I recently opened regarding the dimmed login screen and incorrect redirect on my pull requests.
>- def show_my_data(self):
>- c.show_closed = request.GET.get('pr_show_closed')
>+ def show_my(self):
>+ c.closed = request.GET.get('closed') or ''
>
> def _filter(pr):
> s = sorted(pr, key=lambda o: o.created_on, reverse=True)
>- if not c.show_closed:
>+ if not c.closed:
> s = filter(lambda p: p.status != PullRequest.STATUS_CLOSED, s)
> return s
>
>@@ -232,7 +227,7 @@
> self.authuser.user_id)\
> )
>
>- return render('/pullrequests/pullrequest_show_my_data.html')
>+ return render('/pullrequests/pullrequest_show_my.html')
>
> @LoginRequired()
> @NotAnonymous()
Best regards,
Thomas
More information about the kallithea-general
mailing list