Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(81)

Unified Diff: codereview/views.py

Issue 13433043: Changes to support One-Click Revert in Rietveld
Patch Set: Removing temporary testing code Created 12 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « codereview/urls.py ('k') | codereview/views_chromium.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: codereview/views.py
===================================================================
--- a/codereview/views.py
+++ b/codereview/views.py
@@ -531,6 +531,7 @@
base = forms.CharField(required=False, max_length=MAX_URL)
private = forms.NullBooleanField(required=False)
commit = forms.NullBooleanField(required=False)
+ revert = forms.NullBooleanField(required=False)
created_before = forms.DateTimeField(required=False, label='Created before')
created_after = forms.DateTimeField(
required=False, label='Created on or after')
@@ -2385,6 +2386,10 @@
issue.closed = cleaned_data['closed']
if issue.closed:
issue.commit = False
+ else:
+ # Clear revert bits when issue is re-opened.
+ issue.revert = False
+ issue.reverted_by = None
issue.private = cleaned_data.get('private', False)
base_changed = (issue.base != base)
issue.base = base
@@ -2512,6 +2517,24 @@
@post_required
+@issue_editor_required
+@xsrf_required
+def open(request):
+ """/<issue>/open - Open an issue."""
+ issue = request.issue
+ issue.closed = False
+ issue.commit = False
+ issue.revert = False
+ if request.method == 'POST':
+ new_description = request.POST.get('description')
+ if new_description:
+ issue.description = new_description
+ issue.put()
+ _notify_issue(request, issue, 'Re-opened')
+ return HttpTextResponse('Re-opened')
+
+
+@post_required
@issue_required
@upload_required
def mailissue(request):
@@ -2737,6 +2760,8 @@
'base_url': issue.base,
'private': issue.private,
'commit': issue.commit,
+ 'revert': issue.revert,
+ 'reverted_by': issue.reverted_by,
}
if messages:
values['messages'] = [
@@ -3988,6 +4013,8 @@
q.filter('private = ', form.cleaned_data['private'])
if form.cleaned_data['commit'] is not None:
q.filter('commit = ', form.cleaned_data['commit'])
+ if form.cleaned_data['revert'] is not None:
+ q.filter('revert = ', form.cleaned_data['revert'])
if form.cleaned_data['repo_guid']:
q.filter('repo_guid = ', form.cleaned_data['repo_guid'])
if form.cleaned_data['base']:
« no previous file with comments | « codereview/urls.py ('k') | codereview/views_chromium.py » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b