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 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)