Skip to content

Commit 939b1a7

Browse files
committed
WIP: view Drafts with the Open filter by default
This hides abandoned draft patches unless the user specifically asks to see them. TODO: Does the behavior of the "Clear" button on the filter UI element need to change, or does it actually work the way a user would want for Drafts?
1 parent 4f72169 commit 939b1a7

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

pgcommitfest/commitfest/views.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,16 @@ def patchlist(request, cf, personalized=False):
245245
whereclauses = []
246246
whereparams = {}
247247

248+
in_drafts = cf.status == CommitFest.STATUS_DRAFT
249+
if in_drafts and not request.GET:
250+
# Special case: apply the Open patch filter to Drafts by default
251+
return PatchList(
252+
patches=[],
253+
has_filter=False,
254+
sortkey=0,
255+
redirect=HttpResponseRedirect("%s?status=-2" % (request.path)),
256+
)
257+
248258
if request.GET.get("status", "-1") != "-1":
249259
if request.GET["status"] == "-2":
250260
whereclauses.append("poc.status=ANY(%(openstatuses)s)")
@@ -463,7 +473,7 @@ def patchlist(request, cf, personalized=False):
463473
orderby_str = "topic, created"
464474
sortkey = 0
465475

466-
if not has_filter and sortkey == 0 and request.GET:
476+
if not has_filter and not in_drafts and sortkey == 0 and request.GET:
467477
# Redirect to get rid of the ugly url
468478
return PatchList(
469479
patches=[],

0 commit comments

Comments
 (0)