Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Happy PatchInfo pandas :)

  • Loading branch information...
commit 99d00597f736f569840ceb0978ec1369e7d9abd6 1 parent fc5c7f1
@holdenk authored
View
19 frontend/unicorn/templates/review.html
@@ -1,9 +1,22 @@
+<html>
+<head>
+<title>
Welcome {{ghusername}}!
+</title>
+</head>
+<body>
+<form name="input" action="review" method="post">
{% if newpatch %}
-What do you think of the following review:
-<iframe src="{% url reviewlink %}"></iframe>
-<from action="/review" method="POST">
+Welcome {{ghusername}}! What do you think of the following review:<br/>
+<input type="hidden" value="{{id}}" name="id">
+<a href="{{reviewlink}}" target="_blank">{{reviewlink}}</a><br/>
+<!-- Since we don't run SSL we can't ninja the https review links :( -->
+<!-- <iframe src="{{reviewlink}}" width="100%" height="75%"></iframe><br/> -->
+<input type="submit" value="Yes" name="approve"><input type="submit" value="No" name="approve"><br/>
{% else %}
We have run out of patches to have reviewed! Thanks so much!
{% endif %}
</form>
+</form>
+</body>
+</html>
View
4 frontend/unicorn/verify/models.py
@@ -5,12 +5,12 @@ class PatchInfo(models.Model):
diff_url=models.CharField(max_length=1000, help_text="The URL of the github diff")
target_username=models.CharField(max_length=1000, help_text="The target github user to apply the pull request to (if approved)")
message_txt=models.CharField(max_length=1000, help_text="The commit message text")
- reviewer_username=models.CharField(max_length=1000, help_text="The username of the reviewer")
+ reviewer_username=models.CharField(max_length=1000, help_text="The username of the reviewer", null=True, blank=True)
good = models.BooleanField(max_length=1000, help_text="Is this patch good",
default=False)
examined = models.BooleanField(max_length=1000, help_text="Has this patch been examined",
default=False)
exported = models.BooleanField(max_length=1000, help_text="Has this patch been examined",
default=False)
- touched_time = models.DateTimeField()
+ touched_time = models.DateTimeField(null=True, blank=True)
View
15 frontend/unicorn/verify/views.py
@@ -17,16 +17,27 @@ def review(request):
t = loader.get_template("review.html")
social = UserSocialAuth.objects.filter(user = request.user)
githubusername = social[0].user
+ # Handle post requests first
+ if 'approve' in request.POST:
+ id = request.POST['id']
+ patch = PatchInfo.objects.get(Q(reviewer_username = githubusername), Q(id = id))[0]
+ patch.username = githubusername
+ patch.touched_time = datetime.now()
# Fetch a patch that has not been examined and is either has no reviewer
# the current user as the reviewer OR is more than 2 days since last
# given to a reviewer
newpatch = False
patch = None
+ reviewlink = None
+ id = None
try:
+ newpatch = True
patch = PatchInfo.objects.get(Q(examined=False), Q(reviewer_username = '') | Q(reviewer_username = githubusername) | Q(touched_time__lte=date.today() - timedelta(2)))[0]
patch.username = githubusername
patch.touched_time = datetime.now()
+ reviewlink = patch.diff_url
+ id = patch.id
except Exception, err:
- newpatches = True
- c = Context({'ghusername' : githubusername, 'patch': patch, 'newpatch': newpatch})
+ newpatch = False
+ c = Context({'ghusername' : githubusername, 'patch': patch, 'newpatch': newpatch, 'reviewlink': reviewlink, 'id': id})
return HttpResponse(t.render(c))
Please sign in to comment.
Something went wrong with that request. Please try again.