[extensions-web] review: Don't show the diff view if we don't have an old version



commit 1e002a2547d42167c3e5c6d23d74019f2a873b13
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sun Mar 4 13:28:11 2012 -0500

    review: Don't show the diff view if we don't have an old version
    
    Make the logic a bit more complete on this edge case.

 sweettooth/review/templates/review/review.html |    4 ++--
 sweettooth/review/views.py                     |    2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/sweettooth/review/templates/review/review.html b/sweettooth/review/templates/review/review.html
index 08cd661..9f20ae3 100644
--- a/sweettooth/review/templates/review/review.html
+++ b/sweettooth/review/templates/review/review.html
@@ -35,13 +35,13 @@
   </div>
 </div>
 
-{% if version.version > 1 %}
+{% if has_old_version %}
 <h2 class="expandy_header expanded"> Diff Against Previous Version </h2>
 <div id="diff" data-pk="{{ version.pk }}">
 </div>
 {% endif %}
 
-{% if version.version > 1 %}
+{% if has_old_version %}
 <h2 class="expandy_header"> Files </h2>
 {% else %}
 <h2 class="expandy_header expanded"> Files </h2>
diff --git a/sweettooth/review/views.py b/sweettooth/review/views.py
index 21233d9..cf16a8b 100644
--- a/sweettooth/review/views.py
+++ b/sweettooth/review/views.py
@@ -299,6 +299,7 @@ def review_version_view(request, obj):
     # Other reviews on the same version.
     previous_reviews = version.reviews.all()
 
+    has_old_version = get_old_version(version, None) is not None
     can_approve = can_approve_extension(request.user, extension)
     can_review = can_review_extension(request.user, extension)
 
@@ -306,6 +307,7 @@ def review_version_view(request, obj):
                    version=version,
                    all_versions=all_versions,
                    previous_reviews=previous_reviews,
+                   has_old_version=has_old_version,
                    can_approve=can_approve,
                    can_review=can_review)
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]