]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/models/user.py
merging cacheimp -> trunk
[osqa.git] / forum / models / user.py
index d3b2c6f0042cf70206929b25cd2597cad20a787a..699c7bc5ed015531bf77630f6381d01be8580a6d 100644 (file)
@@ -282,9 +282,9 @@ class User(BaseModel, DjangoUser):
     def can_delete_comment(self, comment):
         return self == comment.author or self.reputation >= int(settings.REP_TO_DELETE_COMMENTS)
 
-    @true_if_is_super_or_staff
     def can_convert_comment_to_answer(self, comment):
-        return self == comment.author or self.reputation >= int(settings.REP_TO_CONVERT_COMMENTS_TO_ANSWERS)
+        return (comment.parent.node_type in ('question', 'answer')) and (self.is_superuser or self.is_staff or (
+            self == comment.author) or (self.reputation >= int(settings.REP_TO_CONVERT_COMMENTS_TO_ANSWERS)))
 
     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