equal
deleted
inserted
replaced
283 return '<%d> %s' % (self.id, self.title) |
283 return '<%d> %s' % (self.id, self.title) |
284 |
284 |
285 def is_reply(self): |
285 def is_reply(self): |
286 return self.reply_to != None |
286 return self.reply_to != None |
287 |
287 |
288 def is_thread_full_visible(self): |
288 def is_thread_full_visible(self, own_user=None): |
289 cur_comment = self |
289 """ |
290 if not cur_comment.state == 'approved': |
290 own_user: comment belonging to this user are also visible |
291 return False |
291 """ |
292 |
292 if self.state == 'approved' or (own_user and self.user == own_user): |
293 while cur_comment.reply_to != None: |
293 if self.reply_to==None: |
294 cur_comment = cur_comment.reply_to |
294 return True |
295 if not cur_comment.state == 'approved': |
295 else: |
296 return False |
296 return self.reply_to.is_thread_full_visible(own_user) |
297 |
297 return False |
298 return True |
298 |
299 |
|
300 def top_comment(self): |
299 def top_comment(self): |
301 if self.reply_to == None : |
300 if self.reply_to == None : |
302 return self |
301 return self |
303 else : |
302 else : |
304 return self.reply_to.top_comment() |
303 return self.reply_to.top_comment() |