]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/models/user.py
Fixes a bug where the profile page of users with now actions could explode.
[osqa.git] / forum / models / user.py
index 36f0e905d4e1357a9a02bb9d86d5345d56fc2a06..b18047e9295ccb208b18293cad1c188ef12e7bc6 100644 (file)
@@ -156,7 +156,10 @@ class User(BaseModel, DjangoUser):
 
     @property
     def last_activity(self):
-        return self.actions.order_by('-action_date')[0].action_date
+        try:
+            return self.actions.order_by('-action_date')[0].action_date
+        except:
+            return None
 
     @property
     def gravatar(self):
@@ -310,7 +313,7 @@ class User(BaseModel, DjangoUser):
 
     @true_if_is_super_or_staff
     def can_reopen_question(self, question):
-        return self == question.author and self.reputation >= settings.REP_TO_REOPEN_OWN
+        return self == question.author and self.reputation >= int(settings.REP_TO_REOPEN_OWN)
 
     @true_if_is_super_or_staff
     def can_delete_post(self, post):