def process_public(self): """Set an addons files to public.""" assert self.version.channel == amo.RELEASE_CHANNEL_LISTED # Sign addon. for file_ in self.files: sign_file(file_, settings.SIGNING_SERVER) # Hold onto the status before we change it. status = self.addon.status self.set_files(amo.STATUS_PUBLIC, self.files) # Increment approvals counter. AddonApprovalsCounter.increment_for_addon(addon=self.addon) self.log_action(amo.LOG.APPROVE_VERSION) template = u'%s_to_public' % self.review_type subject = u'Mozilla Add-ons: %s %s Approved' self.notify_email(template, subject) log.info(u'Making %s files %s public' % (self.addon, ', '.join([f.filename for f in self.files]))) log.info(u'Sending email for %s' % (self.addon)) # Assign reviewer incentive scores. if self.request: ReviewerScore.award_points(self.request.user, self.addon, status)
def confirm_auto_approved(self): """Confirm an auto-approval decision. We don't need to really store that information, what we care about is logging something for future reviewers to be aware of, and, if the version is listed, incrementing AddonApprovalsCounter, which also resets the last human review date to now, and log it so that it's displayed later in the review page.""" status = self.addon.status latest_version = self.version # The confirm auto-approval action should not show the comment box, # so override the text in case the reviewer switched between actions # and accidently submitted some comments from another action. self.data['comments'] = '' if self.content_review_only: # If we're only doing a content review, then don't increment # the counter, just record the date of the content approval # and log it. AddonApprovalsCounter.approve_content_for_addon(addon=self.addon) self.log_action(amo.LOG.APPROVE_CONTENT) else: if self.version.channel == amo.RELEASE_CHANNEL_LISTED: self.version.autoapprovalsummary.update(confirmed=True) AddonApprovalsCounter.increment_for_addon(addon=self.addon) self.log_action(amo.LOG.CONFIRM_AUTO_APPROVED) # Assign reviewer incentive scores. if self.request: ReviewerScore.award_points( self.request.user, self.addon, status, version=latest_version, post_review=True, content_review=self.content_review_only)
def confirm_auto_approved(self): """Confirm an auto-approval decision.""" channel = self.version.channel if channel == amo.RELEASE_CHANNEL_LISTED: # When doing an approval in listed channel, the version we care # about is always current_version and *not* self.version. # This allows reviewers to confirm approval of a public add-on even # when their latest version is disabled. version = self.addon.current_version else: # For unlisted, we just use self.version. version = self.version # The confirm auto-approval action should not show the comment box, # so override the text in case the reviewer switched between actions # and accidently submitted some comments from another action. self.data['comments'] = '' if channel == amo.RELEASE_CHANNEL_LISTED: version.autoapprovalsummary.update(confirmed=True) AddonApprovalsCounter.increment_for_addon(addon=self.addon) self.log_action(amo.LOG.CONFIRM_AUTO_APPROVED, version=version) # Assign reviewer incentive scores. if self.request: is_post_review = channel == amo.RELEASE_CHANNEL_LISTED ReviewerScore.award_points( self.request.user, self.addon, self.addon.status, version=version, post_review=is_post_review, content_review=self.content_review_only)
def approve_latest_version(self): """Approve the add-on latest version (potentially setting the add-on to approved if it was awaiting its first review).""" # Safeguard to force implementation for unlisted add-ons to completely # override this method. assert self.version.channel == amo.RELEASE_CHANNEL_LISTED # Safeguard to make sure this action is not used for content review # (it should use confirm_auto_approved instead). assert not self.content_review # Sign addon. self.sign_files() # Hold onto the status before we change it. status = self.addon.status # Save files first, because set_addon checks to make sure there # is at least one public file or it won't make the addon public. self.set_files(amo.STATUS_APPROVED, self.files) self.set_promoted() if self.set_addon_status: self.set_addon(status=amo.STATUS_APPROVED) if self.human_review: # No need for a human review anymore in this channel. self.clear_all_needs_human_review_flags_in_channel() # Clear pending rejection since we approved that version. VersionReviewerFlags.objects.filter( version=self.version, ).update(pending_rejection=None) # An approval took place so we can reset this. AddonReviewerFlags.objects.update_or_create( addon=self.addon, defaults={'auto_approval_disabled_until_next_approval': False}) # The counter can be incremented. AddonApprovalsCounter.increment_for_addon(addon=self.addon) # Assign reviewer incentive scores. ReviewerScore.award_points(self.user, self.addon, status, version=self.version) else: # Automatic approval, reset the counter. AddonApprovalsCounter.reset_for_addon(addon=self.addon) self.log_action(amo.LOG.APPROVE_VERSION) template = u'%s_to_approved' % self.review_type if self.review_type in ['extension_pending', 'theme_pending']: subject = u'Mozilla Add-ons: %s %s Updated' else: subject = u'Mozilla Add-ons: %s %s Approved' self.notify_email(template, subject) self.log_public_message() log.info(u'Sending email for %s' % (self.addon))
def process_public(self): """Set an add-on or a version to public.""" # Safeguard to force implementation for unlisted add-ons to completely # override this method. assert self.version.channel == amo.RELEASE_CHANNEL_LISTED # Safeguard to make sure this action is not used for content review # (it should use confirm_auto_approved instead). assert not self.content_review_only # Sign addon. use_autograph = waffle.flag_is_active(self.request, 'activate-autograph-signing') for file_ in self.files: sign_file(file_, use_autograph=use_autograph) # Hold onto the status before we change it. status = self.addon.status # Save files first, because set_addon checks to make sure there # is at least one public file or it won't make the addon public. self.set_files(amo.STATUS_PUBLIC, self.files) if self.set_addon_status: self.set_addon(status=amo.STATUS_PUBLIC) # If we've approved a webextension, add a tag identifying them as such. if any(file_.is_webextension for file_ in self.files): Tag(tag_text='firefox57').save_tag(self.addon) # If we've approved a mozilla signed add-on, add the firefox57 tag if all(file_.is_mozilla_signed_extension for file_ in self.files): Tag(tag_text='firefox57').save_tag(self.addon) # Increment approvals counter if we have a request (it means it's a # human doing the review) otherwise reset it as it's an automatic # approval. if self.request: AddonApprovalsCounter.increment_for_addon(addon=self.addon) else: AddonApprovalsCounter.reset_for_addon(addon=self.addon) self.log_action(amo.LOG.APPROVE_VERSION) template = u'%s_to_public' % self.review_type if self.review_type == 'pending': subject = u'Mozilla Add-ons: %s %s Updated' else: subject = u'Mozilla Add-ons: %s %s Approved' self.notify_email(template, subject) self.log_public_message() log.info(u'Sending email for %s' % (self.addon)) # Assign reviewer incentive scores. if self.request: ReviewerScore.award_points(self.request.user, self.addon, status, version=self.version)
def confirm_auto_approved(self): """Confirm an auto-approval decision. We don't need to really store that information, what we care about is incrementing AddonApprovalsCounter, which also resets the last human review date to now, and log it so that it's displayed later in the review page.""" AddonApprovalsCounter.increment_for_addon(addon=self.addon) self.log_action(amo.LOG.CONFIRM_AUTO_APPROVED)
def confirm_auto_approved(self): """Confirm an auto-approval decision.""" channel = self.version.channel if channel == amo.RELEASE_CHANNEL_LISTED: # When doing an approval in listed channel, the version we care # about is always current_version and *not* self.version. # This allows reviewers to confirm approval of a public add-on even # when their latest version is disabled. version = self.addon.current_version else: # For unlisted, we just use self.version. version = self.version # The confirm auto-approval action should not show the comment box, # so override the text in case the reviewer switched between actions # and accidently submitted some comments from another action. self.data['comments'] = '' self.log_action(amo.LOG.CONFIRM_AUTO_APPROVED, version=version) if self.human_review: # Mark the approval as confirmed (handle DoesNotExist, it may have # been auto-approved before we unified workflow for unlisted and # listed). try: version.autoapprovalsummary.update(confirmed=True) except AutoApprovalSummary.DoesNotExist: pass if channel == amo.RELEASE_CHANNEL_LISTED: # Clear needs_human_review flags on past versions in channel. self.unset_past_needs_human_review() AddonApprovalsCounter.increment_for_addon(addon=self.addon) else: # For now, for unlisted versions, only drop the # needs_human_review flag on the latest version. if self.version.needs_human_review: self.version.update(needs_human_review=False) # Clear the "needs_human_review_by_mad" and "pending_rejection" # flags too, if any, only for the specified version. VersionReviewerFlags.objects.filter(version=self.version).update( needs_human_review_by_mad=False, pending_rejection=None) # For other versions, we also clear pending_rejection (Note that # the action should only be accessible to admins if the current # version is pending rejection). VersionReviewerFlags.objects.filter( version__addon=self.addon).update(pending_rejection=None) is_post_review = channel == amo.RELEASE_CHANNEL_LISTED ReviewerScore.award_points(self.user, self.addon, self.addon.status, version=version, post_review=is_post_review, content_review=self.content_review)
def process_public(self): """Set an add-on or a version to public.""" # Safeguard to force implementation for unlisted add-ons to completely # override this method. assert self.version.channel == amo.RELEASE_CHANNEL_LISTED # Safeguard to make sure this action is not used for content review # (it should use confirm_auto_approved instead). assert not self.content_review # Sign addon. self.sign_files() # Hold onto the status before we change it. status = self.addon.status # Save files first, because set_addon checks to make sure there # is at least one public file or it won't make the addon public. self.set_files(amo.STATUS_APPROVED, self.files) self.set_recommended() if self.set_addon_status: self.set_addon(status=amo.STATUS_APPROVED) # Clear needs_human_review flags on past listed versions. if self.human_review: self.unset_past_needs_human_review() # Clear the "needs_human_review" scanner flags too, if any, and # only for the specified version. VersionReviewerFlags.objects.filter(version=self.version).update( needs_human_review_by_mad=False) # Increment approvals counter if we have a request (it means it's a # human doing the review) otherwise reset it as it's an automatic # approval. if self.human_review: AddonApprovalsCounter.increment_for_addon(addon=self.addon) else: AddonApprovalsCounter.reset_for_addon(addon=self.addon) self.log_action(amo.LOG.APPROVE_VERSION) template = u'%s_to_approved' % self.review_type if self.review_type in ['extension_pending', 'theme_pending']: subject = u'Mozilla Add-ons: %s %s Updated' else: subject = u'Mozilla Add-ons: %s %s Approved' self.notify_email(template, subject) self.log_public_message() log.info(u'Sending email for %s' % (self.addon)) # Assign reviewer incentive scores. if self.human_review: ReviewerScore.award_points(self.user, self.addon, status, version=self.version)
def process_public(self): """Set an add-on or a version to public.""" # Safeguard to force implementation for unlisted add-ons to completely # override this method. assert self.version.channel == amo.RELEASE_CHANNEL_LISTED # Safeguard to make sure this action is not used for content review # (it should use confirm_auto_approved instead). assert not self.content_review_only # Sign addon. for file_ in self.files: sign_file(file_) # Hold onto the status before we change it. status = self.addon.status # Save files first, because set_addon checks to make sure there # is at least one public file or it won't make the addon public. self.set_files(amo.STATUS_PUBLIC, self.files) if self.set_addon_status: self.set_addon(status=amo.STATUS_PUBLIC) # If we've approved a webextension, add a tag identifying them as such. if any(file_.is_webextension for file_ in self.files): Tag(tag_text='firefox57').save_tag(self.addon) # If we've approved a mozilla signed add-on, add the firefox57 tag if all(file_.is_mozilla_signed_extension for file_ in self.files): Tag(tag_text='firefox57').save_tag(self.addon) # Increment approvals counter if we have a request (it means it's a # human doing the review) otherwise reset it as it's an automatic # approval. if self.request: AddonApprovalsCounter.increment_for_addon(addon=self.addon) else: AddonApprovalsCounter.reset_for_addon(addon=self.addon) self.log_action(amo.LOG.APPROVE_VERSION) template = u'%s_to_public' % self.review_type if self.review_type == 'pending': subject = u'Mozilla Add-ons: %s %s Updated' else: subject = u'Mozilla Add-ons: %s %s Approved' self.notify_email(template, subject) self.log_public_message() log.info(u'Sending email for %s' % (self.addon)) # Assign reviewer incentive scores. if self.request: ReviewerScore.award_points( self.request.user, self.addon, status, version=self.version)
def confirm_auto_approved(self): """Confirm an auto-approval decision. We don't need to really store that information, what we care about is logging something for future reviewers to be aware of, and, if the version is listed, incrementing AddonApprovalsCounter, which also resets the last human review date to now, and log it so that it's displayed later in the review page.""" if self.version.channel == amo.RELEASE_CHANNEL_LISTED: AddonApprovalsCounter.increment_for_addon(addon=self.addon) self.log_action(amo.LOG.CONFIRM_AUTO_APPROVED)
def confirm_auto_approved(self): """Confirm an auto-approval decision. We don't need to really store that information, what we care about is incrementing AddonApprovalsCounter, which also resets the last human review date to now, and log it so that it's displayed later in the review page.""" AddonApprovalsCounter.increment_for_addon(addon=self.addon) # Log using the latest public version, not self.version, which could # be awaiting review still. self.log_action(amo.LOG.CONFIRM_AUTO_APPROVED, version=self.addon.current_version)
def confirm_auto_approved(self): """Confirm an auto-approval decision. We don't need to really store that information, what we care about is logging something for future reviewers to be aware of, and, if the version is listed, incrementing AddonApprovalsCounter, which also resets the last human review date to now, and log it so that it's displayed later in the review page.""" # The confirm auto-approval action should not show the comment box, # so override the text in case the reviewer switched between actions # and accidently submitted some comments from another action. self.data['comments'] = '' if self.version.channel == amo.RELEASE_CHANNEL_LISTED: AddonApprovalsCounter.increment_for_addon(addon=self.addon) self.log_action(amo.LOG.CONFIRM_AUTO_APPROVED)
def confirm_auto_approved(self): """Confirm an auto-approval decision. We don't need to really store that information, what we care about is logging something for future reviewers to be aware of, and, if the version is listed, incrementing AddonApprovalsCounter, which also resets the last human review date to now, and log it so that it's displayed later in the review page.""" # The confirm auto-approval action should not show the comment box, # so override the text in case the reviewer switched between actions # and accidently submitted some comments from another action. self.data['comments'] = '' if self.version.channel == amo.RELEASE_CHANNEL_LISTED: self.version.autoapprovalsummary.update(confirmed=True) AddonApprovalsCounter.increment_for_addon(addon=self.addon) self.log_action(amo.LOG.CONFIRM_AUTO_APPROVED)
def process_public(self): """Set an add-on or a version to public.""" # Safeguard to force implementation for unlisted add-ons to completely # override this method. assert self.version.channel == amo.RELEASE_CHANNEL_LISTED # Sign addon. for file_ in self.files: sign_file(file_, settings.SIGNING_SERVER) # Hold onto the status before we change it. status = self.addon.status # Save files first, because set_addon checks to make sure there # is at least one public file or it won't make the addon public. self.set_files(amo.STATUS_PUBLIC, self.files) if self.set_addon_status: self.set_addon(status=amo.STATUS_PUBLIC) # If we've approved a webextension, add a tag identifying them as such. if any(file_.is_webextension for file_ in self.files): Tag(tag_text='firefox57').save_tag(self.addon) # Increment approvals counter. AddonApprovalsCounter.increment_for_addon(addon=self.addon) self.log_action(amo.LOG.APPROVE_VERSION) template = u'%s_to_public' % self.review_type subject = u'Mozilla Add-ons: %s %s Approved' self.notify_email(template, subject) self.log_public_message() log.info(u'Sending email for %s' % (self.addon)) # Assign reviewer incentive scores. if self.request: ReviewerScore.award_points(self.request.user, self.addon, status, version=self.version)
def confirm_auto_approved(self): """Confirm an auto-approval decision.""" channel = self.version.channel if channel == amo.RELEASE_CHANNEL_LISTED: # When doing an approval in listed channel, the version we care # about is always current_version and *not* self.version. # This allows reviewers to confirm approval of a public add-on even # when their latest version is disabled. version = self.addon.current_version else: # For unlisted, we just use self.version. version = self.version # The confirm auto-approval action should not show the comment box, # so override the text in case the reviewer switched between actions # and accidently submitted some comments from another action. self.data['comments'] = '' if self.content_review_only: # If we're only doing a content review, then don't increment # the counter, just record the date of the content approval # and log it. AddonApprovalsCounter.approve_content_for_addon(addon=self.addon) self.log_action(amo.LOG.APPROVE_CONTENT, version=version) else: if channel == amo.RELEASE_CHANNEL_LISTED: version.autoapprovalsummary.update(confirmed=True) AddonApprovalsCounter.increment_for_addon(addon=self.addon) self.log_action(amo.LOG.CONFIRM_AUTO_APPROVED, version=version) # Assign reviewer incentive scores. if self.request: is_post_review = channel == amo.RELEASE_CHANNEL_LISTED ReviewerScore.award_points( self.request.user, self.addon, self.addon.status, version=version, post_review=is_post_review, content_review=self.content_review_only)