X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/45534929ae6c2bc3d2d02be6c6f23f3caef02c65..c72f65e13db0229d8f5f74b69dc9bdba88d55d75:/forum/models/user.py diff --git a/forum/models/user.py b/forum/models/user.py index 5aa8cc8..e50c1f0 100644 --- a/forum/models/user.py +++ b/forum/models/user.py @@ -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 self.last_seen @property def gravatar(self): @@ -276,6 +279,10 @@ class User(BaseModel, DjangoUser): def can_convert_to_comment(self, answer): return (not answer.marked) and (self.is_superuser or self.is_staff or answer.author == self or self.reputation >= int (settings.REP_TO_CONVERT_TO_COMMENT)) + + def can_convert_to_question(self, answer): + return (not answer.marked) and (self.is_superuser or self.is_staff or answer.author == self or self.reputation >= int + (settings.REP_TO_CONVERT_TO_QUESTION)) @true_if_is_super_or_staff def can_accept_answer(self, answer):