def _get_comments_for_hard_deleted_versions(addon):
 class PseudoVersion(object, ):
  def __init__(self):
   self.all_activity = []
  all_files = ()
  approvalnotes = None
  compatible_apps_ordered = ()
  releasenotes = None
  status = 'Deleted'
  deleted = True
  channel = amo.RELEASE_CHANNEL_LISTED
  @property
  def created(self):
   return self.all_activity[0].created
  @property
  def version(self):
   return self.all_activity[0].activity_log.details.get('version', '[deleted]')
 comments = CommentLog.objects.filter(activity_log__action__in=amo.LOG_REVIEW_QUEUE, activity_log__versionlog=None, activity_log__addonlog__addon=addon).order_by('created').select_related('activity_log')
 comment_versions = defaultdict(PseudoVersion)
 for c in comments:
  c.version = c.activity_log.details.get('version', c.created)
  comment_versions[c.version].all_activity.append(c)
 return comment_versions.values()

def _get_comments_for_hard_deleted_versions ( addon ) : class PseudoVersion ( object , ) : def __init__ ( self ) : self . all_activity = [ ] all_files = ( ) approvalnotes = None compatible_apps_ordered = ( ) releasenotes = None status = 'Deleted' deleted = True channel = amo . RELEASE_CHANNEL_LISTED @ property def created ( self ) : return self . all_activity [ 0 ] . created @ property def version ( self ) : return self . all_activity [ 0 ] . activity_log . details . get ( 'version' , '[deleted]' ) comments = CommentLog . objects . filter ( activity_log__action__in = amo . LOG_REVIEW_QUEUE , activity_log__versionlog = None , activity_log__addonlog__addon = addon ) . order_by ( 'created' ) . select_related ( 'activity_log' ) comment_versions = defaultdict ( PseudoVersion ) for c in comments : c . version = c . activity_log . details . get ( 'version' , c . created ) comment_versions [ c . version ] . all_activity . append ( c ) return comment_versions . values ( )
versions are soft-deleted now but we need to grab review history for older deleted versions that were hard-deleted so the only record we have of them is in the review log .