Exemplo n.º 1
0
    def process_public(self, auto_validation=False):
        """Set an addon to public."""
        if self.review_type == 'preliminary':
            raise AssertionError('Preliminary addons cannot be made public.')

        # 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, copy_to_mirror=True)
        self.set_addon(highest_status=amo.STATUS_PUBLIC,
                       status=amo.STATUS_PUBLIC)

        self.log_action(amo.LOG.APPROVE_VERSION)
        template = u'%s_to_public' % self.review_type
        subject = u'Mozilla Add-ons: %s %s Fully Reviewed'
        if not self.addon.is_listed:
            template = u'unlisted_to_reviewed'
            if auto_validation:
                template = u'unlisted_to_reviewed_auto'
            subject = u'Mozilla Add-ons: %s %s signed and ready to download'
        self.notify_email(template, subject)

        log.info(u'Making %s public' % (self.addon))
        log.info(u'Sending email for %s' % (self.addon))

        # Assign reviewer incentive scores.
        if self.request and not auto_validation:
            ReviewerScore.award_points(self.request.user, self.addon, status)
Exemplo n.º 2
0
    def process_public(self):
        """Set an addons files to public."""
        if self.review_type == 'preliminary':
            raise AssertionError('Preliminary addons cannot be made public.')

        # 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, copy_to_mirror=True)

        self.log_action(amo.LOG.APPROVE_VERSION)
        template = u'%s_to_public' % self.review_type
        subject = u'Mozilla Add-ons: %s %s Fully Reviewed'
        if not self.addon.is_listed:
            template = u'unlisted_to_reviewed'
            subject = u'Mozilla Add-ons: %s %s signed and ready to download'
        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.amo_user, self.addon,
                                       status)
Exemplo n.º 3
0
    def save(self):
        action = self.cleaned_data['action']
        comment = self.cleaned_data.get('comment')
        reject_reason = self.cleaned_data.get('reject_reason')
        theme = self.cleaned_data['theme']

        is_rereview = (
            theme.rereviewqueuetheme_set.exists() and
            theme.addon.status not in (amo.STATUS_PENDING,
                                       amo.STATUS_REVIEW_PENDING))

        theme_lock = ThemeLock.objects.get(theme=self.cleaned_data['theme'])

        mail_and_log = True
        if action == rvw.ACTION_APPROVE:
            if is_rereview:
                approve_rereview(theme)
            theme.addon.update(status=amo.STATUS_PUBLIC)
            theme.approve = datetime.datetime.now()
            theme.save()

        elif action == rvw.ACTION_REJECT:
            if is_rereview:
                reject_rereview(theme)
            else:
                theme.addon.update(status=amo.STATUS_REJECTED)

        elif action == rvw.ACTION_DUPLICATE:
            if is_rereview:
                reject_rereview(theme)
            else:
                theme.addon.update(status=amo.STATUS_REJECTED)

        elif action == rvw.ACTION_FLAG:
            if is_rereview:
                mail_and_log = False
            else:
                theme.addon.update(status=amo.STATUS_REVIEW_PENDING)

        elif action == rvw.ACTION_MOREINFO:
            if not is_rereview:
                theme.addon.update(status=amo.STATUS_REVIEW_PENDING)

        if mail_and_log:
            send_mail(self.cleaned_data, theme_lock)

            # Log.
            amo.log(amo.LOG.THEME_REVIEW, theme.addon, details={
                    'theme': theme.addon.name.localized_string,
                    'action': action,
                    'reject_reason': reject_reason,
                    'comment': comment}, user=theme_lock.reviewer)
            log.info('%sTheme %s (%s) - %s' % (
                '[Rereview] ' if is_rereview else '', theme.addon.name,
                theme.id, action))

        if action not in [rvw.ACTION_MOREINFO, rvw.ACTION_FLAG]:
            ReviewerScore.award_points(theme_lock.reviewer, theme.addon,
                                       theme.addon.status)
        theme_lock.delete()
Exemplo n.º 4
0
    def process_preliminary(self, auto_validation=False):
        """Set an addons files to preliminary."""
        # Sign addon.
        for file_ in self.files:
            sign_file(file_, settings.PRELIMINARY_SIGNING_SERVER)

        # Hold onto the status before we change it.
        status = self.addon.status

        self.set_files(amo.STATUS_LITE, self.files, copy_to_mirror=True)

        self.log_action(amo.LOG.PRELIMINARY_VERSION)
        template = u'%s_to_preliminary' % self.review_type
        subject = u'Mozilla Add-ons: %s %s Preliminary Reviewed'
        if not self.addon.is_listed:
            template = u'unlisted_to_reviewed'
            if auto_validation:
                template = u'unlisted_to_reviewed_auto'
            subject = u'Mozilla Add-ons: %s %s signed and ready to download'
        self.notify_email(template, subject)

        log.info(u'Making %s files %s preliminary' %
                 (self.addon, ', '.join([f.filename for f in self.files])))
        log.info(u'Sending email for %s' % (self.addon))

        if self.request and not auto_validation:
            # Assign reviewer incentive scores.
            ReviewerScore.award_points(self.request.amo_user, self.addon,
                                       status)
Exemplo n.º 5
0
    def process_sandbox(self):
        """Set an addons files to sandbox."""
        # Hold onto the status before we change it.
        status = self.addon.status

        self.set_files(amo.STATUS_DISABLED, self.files,
                       hide_disabled_file=True)

        self.log_action(amo.LOG.REJECT_VERSION)
        template = u'%s_to_sandbox' % self.review_type
        subject = u'Mozilla Add-ons: %s %s Rejected'
        if not self.addon.is_listed:
            template = u'unlisted_to_sandbox'
            subject = u'Mozilla Add-ons: %s %s didn\'t pass review'
        self.notify_email(template, subject)

        log.info(u'Making %s files %s disabled' %
                 (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.amo_user, self.addon,
                                       status)
Exemplo n.º 6
0
    def process_sandbox(self):
        """Reject an app."""
        # Hold onto the status before we change it.
        status = self.addon.status

        self.set_files(amo.STATUS_DISABLED, self.version.files.all(),
                       hide_disabled_file=True)
        # If this app is not packaged (packaged apps can have multiple
        # versions) or if there aren't other versions with already reviewed
        # files, reject the app also.
        if (not self.addon.is_packaged or
            not self.addon.versions.exclude(id=self.version.id)
                .filter(files__status__in=amo.REVIEWED_STATUSES).exists()):
            self.set_addon(status=amo.STATUS_REJECTED)

        if self.in_escalate:
            EscalationQueue.objects.filter(addon=self.addon).delete()
        if self.in_rereview:
            RereviewQueue.objects.filter(addon=self.addon).delete()

        self.log_action(amo.LOG.REJECT_VERSION)
        self.notify_email('pending_to_sandbox', u'Submission Update: %s')

        log.info(u'Making %s disabled' % self.addon)
        log.info(u'Sending email for %s' % self.addon)

        # Assign reviewer incentive scores.
        ReviewerScore.award_points(self.request.amo_user, self.addon, status,
                                   in_rereview=self.in_rereview)
        self.create_comm_thread(action='reject')
Exemplo n.º 7
0
 def process_clear_rereview(self):
     """Clear app from re-review queue."""
     RereviewQueue.objects.filter(addon=self.addon).delete()
     self.log_action(amo.LOG.REREVIEW_CLEARED)
     log.info(u"Re-review cleared for app: %s" % self.addon)
     # Assign reviewer incentive scores.
     ReviewerScore.award_points(self.request.amo_user, self.addon, self.addon.status, in_rereview=True)
Exemplo n.º 8
0
    def process_sandbox(self):
        """Set an addon back to sandbox."""

        # Hold onto the status before we change it.
        status = self.addon.status

        if (not self.is_upgrade or
            not self.addon.versions.exclude(id=self.version.id)
                          .filter(files__status__in=amo.REVIEWED_STATUSES)):
            self.set_addon(status=amo.STATUS_NULL)
        else:
            self.set_addon(status=amo.STATUS_LITE)

        self.set_files(amo.STATUS_DISABLED, self.version.files.all(),
                       hide_disabled_file=True)

        self.log_action(amo.LOG.REJECT_VERSION)
        self.notify_email('%s_to_sandbox' % self.review_type,
                          u'Mozilla Add-ons: %s %s Rejected')

        log.info(u'Making %s disabled' % (self.addon))
        log.info(u'Sending email for %s' % (self.addon))

        # Assign reviewer incentive scores.
        ReviewerScore.award_points(self.request.amo_user, self.addon, status)
Exemplo n.º 9
0
    def process_preliminary(self):
        """Set an addon to preliminary."""
        # Hold onto the status before we change it.
        status = self.addon.status

        changes = {'status': amo.STATUS_LITE}
        if (self.addon.status in (amo.STATUS_PUBLIC,
                                  amo.STATUS_LITE_AND_NOMINATED)):
            changes['highest_status'] = amo.STATUS_LITE

        template = '%s_to_preliminary' % self.review_type
        if (self.review_type == 'preliminary' and
                self.addon.status == amo.STATUS_LITE_AND_NOMINATED):
            template = 'nominated_to_nominated'

        self.set_addon(**changes)
        self.set_files(amo.STATUS_LITE, self.version.files.all(),
                       copy_to_mirror=True)

        self.log_action(amo.LOG.PRELIMINARY_VERSION)
        self.notify_email(template,
                          u'Mozilla Add-ons: %s %s Preliminary Reviewed')

        log.info(u'Making %s preliminary' % (self.addon))
        log.info(u'Sending email for %s' % (self.addon))

        # Assign reviewer incentive scores.
        ReviewerScore.award_points(self.request.amo_user, self.addon, status)
Exemplo n.º 10
0
    def process_public(self, auto_validation=False):
        """Set an addons files to public."""
        if self.review_type == "preliminary":
            raise AssertionError("Preliminary addons cannot be made public.")

        # 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, copy_to_mirror=True)

        self.log_action(amo.LOG.APPROVE_VERSION)
        template = u"%s_to_public" % self.review_type
        subject = u"Mozilla Add-ons: %s %s Fully Reviewed"
        if not self.addon.is_listed:
            template = u"unlisted_to_reviewed"
            if auto_validation:
                template = u"unlisted_to_reviewed_auto"
            subject = u"Mozilla Add-ons: %s %s signed and ready to download"
        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 and not auto_validation:
            ReviewerScore.award_points(self.request.user, self.addon, status)
Exemplo n.º 11
0
    def process_preliminary(self, auto_validation=False):
        """Set an addon to preliminary."""
        # Sign addon.
        for file_ in self.files:
            sign_file(file_, settings.PRELIMINARY_SIGNING_SERVER)

        # Hold onto the status before we change it.
        status = self.addon.status

        changes = {"status": amo.STATUS_LITE}
        if self.addon.status in (amo.STATUS_PUBLIC, amo.STATUS_LITE_AND_NOMINATED):
            changes["highest_status"] = amo.STATUS_LITE

        template = u"%s_to_preliminary" % self.review_type
        subject = u"Mozilla Add-ons: %s %s Preliminary Reviewed"
        if self.review_type == "preliminary" and self.addon.status == amo.STATUS_LITE_AND_NOMINATED:
            template = u"nominated_to_nominated"
        if not self.addon.is_listed:
            template = u"unlisted_to_reviewed"
            if auto_validation:
                template = u"unlisted_to_reviewed_auto"
            subject = u"Mozilla Add-ons: %s %s signed and ready to download"

        self.set_addon(**changes)
        self.set_files(amo.STATUS_LITE, self.files, copy_to_mirror=True)

        self.log_action(amo.LOG.PRELIMINARY_VERSION)
        self.notify_email(template, subject)

        log.info(u"Making %s preliminary" % (self.addon))
        log.info(u"Sending email for %s" % (self.addon))

        if self.request and not auto_validation:
            # Assign reviewer incentive scores.
            ReviewerScore.award_points(self.request.user, self.addon, status)
Exemplo n.º 12
0
    def process_sandbox(self):
        """Set an addon back to sandbox."""

        # Hold onto the status before we change it.
        status = self.addon.status

        if not self.is_upgrade or not self.addon.versions.exclude(id=self.version.id).filter(
            files__status__in=amo.REVIEWED_STATUSES
        ):
            self.set_addon(status=amo.STATUS_NULL)
        else:
            self.set_addon(status=amo.STATUS_LITE)

        self.set_files(amo.STATUS_DISABLED, self.files, hide_disabled_file=True)

        self.log_action(amo.LOG.REJECT_VERSION)
        template = u"%s_to_sandbox" % self.review_type
        subject = u"Mozilla Add-ons: %s %s Rejected"
        if not self.addon.is_listed:
            template = u"unlisted_to_sandbox"
            subject = u"Mozilla Add-ons: %s %s didn't pass review"
        self.notify_email(template, subject)

        log.info(u"Making %s disabled" % (self.addon))
        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)
Exemplo n.º 13
0
    def process_public(self):
        if self.addon.make_public == amo.PUBLIC_IMMEDIATELY:
            self.process_public_immediately()
        else:
            self.process_public_waiting()

        if self.in_escalate:
            EscalationQueue.objects.filter(addon=self.addon).delete()

        # Assign reviewer incentive scores.
        event = ReviewerScore.get_event_by_type(self.addon)
        ReviewerScore.award_points(self.request.amo_user, self.addon, event)
Exemplo n.º 14
0
    def process_public(self):
        # Hold onto the status before we change it.
        status = self.addon.status

        if self.addon.make_public == amo.PUBLIC_IMMEDIATELY:
            self.process_public_immediately()
        else:
            self.process_public_waiting()

        if self.in_escalate:
            EscalationQueue.objects.filter(addon=self.addon).delete()

        # Assign reviewer incentive scores.
        ReviewerScore.award_points(self.request.amo_user, self.addon, status)
Exemplo n.º 15
0
    def process_public_waiting(self):
        """Make an app pending."""
        self.set_files(amo.STATUS_PUBLIC_WAITING, self.version.files.all())
        self.set_addon(highest_status=amo.STATUS_PUBLIC_WAITING, status=amo.STATUS_PUBLIC_WAITING)

        self.log_action(amo.LOG.APPROVE_VERSION_WAITING)
        self.notify_email("%s_to_public_waiting" % self.review_type, u"App Approved but waiting: %s")

        log.info(u"Making %s public but pending" % self.addon)
        log.info(u"Sending email for %s" % self.addon)

        # Assign reviewer incentive scores.
        event = ReviewerScore.get_event_by_type(self.addon)
        ReviewerScore.award_points(self.request.amo_user, self.addon, event)
Exemplo n.º 16
0
    def process_public(self):
        """
        Makes an app public or public waiting.
        Changes status to Public/Public Waiting.
        Creates Approval note/email.
        """
        if self.addon.has_incomplete_status():
            # Failsafe.
            return

        # Hold onto the status before we change it.
        status = self.addon.status
        if self.addon.make_public == amo.PUBLIC_IMMEDIATELY:
            self._process_public_immediately()
        else:
            self._process_public_waiting()

        if self.in_escalate:
            EscalationQueue.objects.filter(addon=self.addon).delete()

        # Clear priority_review flag on approval - its not persistant.
        if self.addon.priority_review:
            self.addon.update(priority_review=False)

        # Assign reviewer incentive scores.
        return ReviewerScore.award_points(self.request.amo_user, self.addon,
                                          status)
Exemplo n.º 17
0
    def process_public_immediately(self):
        """Approve an app."""
        # 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.version.files.all())
        self.set_addon(highest_status=amo.STATUS_PUBLIC, status=amo.STATUS_PUBLIC)

        self.log_action(amo.LOG.APPROVE_VERSION)
        self.notify_email("%s_to_public" % self.review_type, u"App Approved: %s")

        log.info(u"Making %s public" % self.addon)
        log.info(u"Sending email for %s" % self.addon)

        # Assign reviewer incentive scores.
        event = ReviewerScore.get_event_by_type(self.addon)
        ReviewerScore.award_points(self.request.amo_user, self.addon, event)
Exemplo n.º 18
0
    def process_public(self):
        """
        Makes an app public or public waiting.
        Changes status to Public/Public Waiting.
        Creates Approval note/email.
        """
        if self.addon.has_incomplete_status():
            # Failsafe.
            return

        # Create thread.
        self._create_comm_note(comm.APPROVAL)

        # Hold onto the status before we change it.
        status = self.addon.status
        if self.addon.make_public == amo.PUBLIC_IMMEDIATELY:
            self._process_public_immediately()
        else:
            self._process_public_waiting()

        if self.in_escalate:
            EscalationQueue.objects.filter(addon=self.addon).delete()

        # Assign reviewer incentive scores.
        return ReviewerScore.award_points(self.request.amo_user, self.addon,
                                          status)
Exemplo n.º 19
0
    def process_sandbox(self):
        """Set an addons files to sandbox."""
        # Hold onto the status before we change it.
        status = self.addon.status

        self.set_files(amo.STATUS_DISABLED, self.data["addon_files"], hide_disabled_file=True)

        self.log_action(amo.LOG.REJECT_VERSION)
        self.notify_email("%s_to_sandbox" % self.review_type, u"Mozilla Add-ons: %s %s Rejected")

        log.info(
            u"Making %s files %s disabled" % (self.addon, ", ".join([f.filename for f in self.data["addon_files"]]))
        )
        log.info(u"Sending email for %s" % (self.addon))

        # Assign reviewer incentive scores.
        ReviewerScore.award_points(self.request.amo_user, self.addon, status)
Exemplo n.º 20
0
    def process_preliminary(self):
        """Set an addons files to preliminary."""
        # Hold onto the status before we change it.
        status = self.addon.status

        self.set_files(amo.STATUS_LITE, self.data["addon_files"], copy_to_mirror=True)

        self.log_action(amo.LOG.PRELIMINARY_VERSION)
        self.notify_email("%s_to_preliminary" % self.review_type, u"Mozilla Add-ons: %s %s Preliminary Reviewed")

        log.info(
            u"Making %s files %s preliminary" % (self.addon, ", ".join([f.filename for f in self.data["addon_files"]]))
        )
        log.info(u"Sending email for %s" % (self.addon))

        # Assign reviewer incentive scores.
        ReviewerScore.award_points(self.request.amo_user, self.addon, status)
Exemplo n.º 21
0
    def process_public(self):
        """Set an addons files to public."""
        if self.review_type == "preliminary":
            raise AssertionError("Preliminary addons cannot be made public.")

        # Hold onto the status before we change it.
        status = self.addon.status

        self.set_files(amo.STATUS_PUBLIC, self.data["addon_files"], copy_to_mirror=True)

        self.log_action(amo.LOG.APPROVE_VERSION)
        self.notify_email("%s_to_public" % self.review_type, u"Mozilla Add-ons: %s %s Fully Reviewed")

        log.info(u"Making %s files %s public" % (self.addon, ", ".join([f.filename for f in self.data["addon_files"]])))
        log.info(u"Sending email for %s" % (self.addon))

        # Assign reviewer incentive scores.
        ReviewerScore.award_points(self.request.amo_user, self.addon, status)
Exemplo n.º 22
0
    def process_preliminary(self):
        """Set an addons files to preliminary."""
        if self.addon.is_premium():
            raise AssertionError('Premium add-ons cannot become preliminary.')

        self.set_files(amo.STATUS_LITE, self.data['addon_files'],
                       copy_to_mirror=True)

        self.log_action(amo.LOG.PRELIMINARY_VERSION)
        self.notify_email('%s_to_preliminary' % self.review_type,
                          u'Mozilla Add-ons: %s %s Preliminary Reviewed')

        log.info(u'Making %s files %s preliminary' %
                 (self.addon,
                  ', '.join([f.filename for f in self.data['addon_files']])))
        log.info(u'Sending email for %s' % (self.addon))

        # Assign reviewer incentive scores.
        event = ReviewerScore.get_event_by_type(self.addon, self.review_type)
        ReviewerScore.award_points(self.request.amo_user, self.addon, event)
Exemplo n.º 23
0
    def process_public(self):
        """Set an addons files to public."""
        if self.review_type == 'preliminary':
            raise AssertionError('Preliminary addons cannot be made public.')

        self.set_files(amo.STATUS_PUBLIC, self.data['addon_files'],
                       copy_to_mirror=True)

        self.log_action(amo.LOG.APPROVE_VERSION)
        self.notify_email('%s_to_public' % self.review_type,
                          u'Mozilla Add-ons: %s %s Fully Reviewed')

        log.info(u'Making %s files %s public' %
                 (self.addon,
                  ', '.join([f.filename for f in self.data['addon_files']])))
        log.info(u'Sending email for %s' % (self.addon))

        # Assign reviewer incentive scores.
        event = ReviewerScore.get_event_by_type(self.addon, self.review_type)
        ReviewerScore.award_points(self.request.amo_user, self.addon, event)
Exemplo n.º 24
0
 def process_clear_rereview(self):
     """
     Clear app from re-review queue.
     Doesn't change status.
     Doesn't create note/email.
     """
     RereviewQueue.objects.filter(addon=self.addon).delete()
     self.create_note(amo.LOG.REREVIEW_CLEARED)
     log.info(u'Re-review cleared for app: %s' % self.addon)
     # Assign reviewer incentive scores.
     return ReviewerScore.award_points(self.request.amo_user, self.addon,
                                       self.addon.status, in_rereview=True)
Exemplo n.º 25
0
    def process_public(self):
        """Set an addon to public."""
        if self.review_type == "preliminary":
            raise AssertionError("Preliminary addons cannot be made public.")

        # 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.version.files.all(), copy_to_mirror=True)
        self.set_addon(highest_status=amo.STATUS_PUBLIC, status=amo.STATUS_PUBLIC)

        self.log_action(amo.LOG.APPROVE_VERSION)
        self.notify_email("%s_to_public" % self.review_type, u"Mozilla Add-ons: %s %s Fully Reviewed")

        log.info(u"Making %s public" % (self.addon))
        log.info(u"Sending email for %s" % (self.addon))

        # Assign reviewer incentive scores.
        ReviewerScore.award_points(self.request.amo_user, self.addon, status)
Exemplo n.º 26
0
    def process_public(self):
        """Set an addon to public."""
        if self.review_type == 'preliminary':
            raise AssertionError('Preliminary addons cannot be made public.')

        # 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.version.files.all(),
                       copy_to_mirror=True)
        self.set_addon(highest_status=amo.STATUS_PUBLIC,
                       status=amo.STATUS_PUBLIC)

        self.log_action(amo.LOG.APPROVE_VERSION)
        self.notify_email('%s_to_public' % self.review_type,
                          u'Mozilla Add-ons: %s %s Fully Reviewed')

        log.info(u'Making %s public' % (self.addon))
        log.info(u'Sending email for %s' % (self.addon))

        # Assign reviewer incentive scores.
        event = ReviewerScore.get_event_by_type(self.addon, self.review_type)
        ReviewerScore.award_points(self.request.amo_user, self.addon, event)
Exemplo n.º 27
0
 def process_clear_rereview(self):
     """
     Clear app from re-review queue.
     Doesn't change status.
     Doesn't create note/email.
     """
     RereviewQueue.objects.filter(addon=self.addon).delete()
     self.create_note(amo.LOG.REREVIEW_CLEARED)
     log.info(u'Re-review cleared for app: %s' % self.addon)
     # Assign reviewer incentive scores.
     return ReviewerScore.award_points(self.request.amo_user,
                                       self.addon,
                                       self.addon.status,
                                       in_rereview=True)
Exemplo n.º 28
0
    def process_sandbox(self):
        """Set an addons files to sandbox."""
        # Hold onto the status before we change it.
        status = self.addon.status

        self.set_files(amo.STATUS_DISABLED,
                       self.files,
                       hide_disabled_file=True)

        self.log_action(amo.LOG.REJECT_VERSION)
        template = u'%s_to_sandbox' % self.review_type
        subject = u'Mozilla Add-ons: %s %s Rejected'
        if not self.addon.is_listed:
            template = u'unlisted_to_sandbox'
            subject = u'Mozilla Add-ons: %s %s didn\'t pass review'
        self.notify_email(template, subject)

        log.info(u'Making %s files %s disabled' %
                 (self.addon, ', '.join([f.filename for f in self.files])))
        log.info(u'Sending email for %s' % (self.addon))

        # Assign reviewer incentive scores.
        ReviewerScore.award_points(self.request.amo_user, self.addon, status)
Exemplo n.º 29
0
    def process_public(self):
        """Set an addon to public."""
        if self.review_type == 'preliminary':
            raise AssertionError('Preliminary addons cannot be made public.')

        # 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.version.files.all(),
                       copy_to_mirror=True)
        self.set_addon(highest_status=amo.STATUS_PUBLIC,
                       status=amo.STATUS_PUBLIC)

        self.log_action(amo.LOG.APPROVE_VERSION)
        self.notify_email('%s_to_public' % self.review_type,
                          u'Mozilla Add-ons: %s %s Fully Reviewed')

        log.info(u'Making %s public' % (self.addon))
        log.info(u'Sending email for %s' % (self.addon))

        # Assign reviewer incentive scores.
        event = ReviewerScore.get_event_by_type(self.addon, self.review_type)
        ReviewerScore.award_points(self.request.amo_user, self.addon, event)
Exemplo n.º 30
0
    def process_preliminary(self, auto_validation=False):
        """Set an addon to preliminary."""
        # Sign addon.
        for file_ in self.files:
            sign_file(file_, settings.PRELIMINARY_SIGNING_SERVER)

        # Hold onto the status before we change it.
        status = self.addon.status

        changes = {'status': amo.STATUS_LITE}
        if (self.addon.status
                in (amo.STATUS_PUBLIC, amo.STATUS_LITE_AND_NOMINATED)):
            changes['highest_status'] = amo.STATUS_LITE

        template = u'%s_to_preliminary' % self.review_type
        subject = u'Mozilla Add-ons: %s %s Preliminary Reviewed'
        if (self.review_type == 'preliminary'
                and self.addon.status == amo.STATUS_LITE_AND_NOMINATED):
            template = u'nominated_to_nominated'
        if not self.addon.is_listed:
            template = u'unlisted_to_reviewed'
            if auto_validation:
                template = u'unlisted_to_reviewed_auto'
            subject = u'Mozilla Add-ons: %s %s signed and ready to download'

        self.set_addon(**changes)
        self.set_files(amo.STATUS_LITE, self.files, copy_to_mirror=True)

        self.log_action(amo.LOG.PRELIMINARY_VERSION)
        self.notify_email(template, subject)

        log.info(u'Making %s preliminary' % (self.addon))
        log.info(u'Sending email for %s' % (self.addon))

        if self.request and not auto_validation:
            # Assign reviewer incentive scores.
            ReviewerScore.award_points(self.request.user, self.addon, status)
Exemplo n.º 31
0
    def process_preliminary(self):
        """Set an addon to preliminary."""
        # Sign addon.
        for file_ in self.files:
            sign_file(file_, settings.PRELIMINARY_SIGNING_SERVER)

        # Hold onto the status before we change it.
        status = self.addon.status

        changes = {'status': amo.STATUS_LITE}
        if (self.addon.status in (amo.STATUS_PUBLIC,
                                  amo.STATUS_LITE_AND_NOMINATED)):
            changes['highest_status'] = amo.STATUS_LITE

        template = u'%s_to_preliminary' % self.review_type
        subject = u'Mozilla Add-ons: %s %s Preliminary Reviewed'
        if (self.review_type == 'preliminary' and
                self.addon.status == amo.STATUS_LITE_AND_NOMINATED):
            template = u'nominated_to_nominated'
        if not self.addon.is_listed:
            template = u'unlisted_to_reviewed'
            subject = u'Mozilla Add-ons: %s %s signed and ready to download'

        self.set_addon(**changes)
        self.set_files(amo.STATUS_LITE, self.files, copy_to_mirror=True)

        self.log_action(amo.LOG.PRELIMINARY_VERSION)
        self.notify_email(template, subject)

        log.info(u'Making %s preliminary' % (self.addon))
        log.info(u'Sending email for %s' % (self.addon))

        if self.request:
            # Assign reviewer incentive scores.
            ReviewerScore.award_points(self.request.amo_user, self.addon,
                                       status)
Exemplo n.º 32
0
    def process_public(self):
        if self.addon.is_incomplete():
            # Failsafe.
            return

        # Hold onto the status before we change it.
        status = self.addon.status
        self.create_comm_thread(action='approve')
        if self.addon.make_public == amo.PUBLIC_IMMEDIATELY:
            self.process_public_immediately()
        else:
            self.process_public_waiting()

        if self.in_escalate:
            EscalationQueue.objects.filter(addon=self.addon).delete()

        # Assign reviewer incentive scores.
        return ReviewerScore.award_points(self.request.amo_user, self.addon, status)
Exemplo n.º 33
0
    def process_public(self):
        if waffle.switch_is_active('iarc') and not self.addon.is_rated():
            # Shouldn't be able to get here. Don't allow unrated apps to go
            # live.
            return

        # Hold onto the status before we change it.
        status = self.addon.status
        self.create_comm_thread(action='approve')
        if self.addon.make_public == amo.PUBLIC_IMMEDIATELY:
            self.process_public_immediately()
        else:
            self.process_public_waiting()

        if self.in_escalate:
            EscalationQueue.objects.filter(addon=self.addon).delete()

        # Assign reviewer incentive scores.
        return ReviewerScore.award_points(self.request.amo_user, self.addon, status)
Exemplo n.º 34
0
    def process_public(self):
        if self.addon.is_incomplete():
            # Failsafe.
            return

        # Hold onto the status before we change it.
        status = self.addon.status
        self.create_comm_thread(action='approve')
        if self.addon.make_public == amo.PUBLIC_IMMEDIATELY:
            self.process_public_immediately()
        else:
            self.process_public_waiting()

        if self.in_escalate:
            EscalationQueue.objects.filter(addon=self.addon).delete()

        # Assign reviewer incentive scores.
        return ReviewerScore.award_points(self.request.amo_user, self.addon,
                                          status)
Exemplo n.º 35
0
    def process_public(self):
        """
        Makes an app public or public waiting.
        Changes status to Public/Public Waiting.
        Creates Approval note/email.
        """
        if self.addon.has_incomplete_status():
            # Failsafe.
            return

        # Hold onto the status before we change it.
        status = self.addon.status
        if self.addon.make_public == amo.PUBLIC_IMMEDIATELY:
            self._process_public_immediately()
        else:
            self._process_public_waiting()

        if self.in_escalate:
            EscalationQueue.objects.filter(addon=self.addon).delete()

        # Assign reviewer incentive scores.
        return ReviewerScore.award_points(self.request.amo_user, self.addon,
                                          status)
Exemplo n.º 36
0
    def process_reject(self):
        """
        Reject an app.
        Changes status to Rejected.
        Creates Rejection note/email.
        """
        # Hold onto the status before we change it.
        status = self.addon.status

        self.set_files(amo.STATUS_DISABLED,
                       self.version.files.all(),
                       hide_disabled_file=True)
        # If this app is not packaged (packaged apps can have multiple
        # versions) or if there aren't other versions with already reviewed
        # files, reject the app also.
        if (not self.addon.is_packaged
                or not self.addon.versions.exclude(id=self.version.id).filter(
                    files__status__in=amo.REVIEWED_STATUSES).exists()):
            self.set_addon(status=amo.STATUS_REJECTED)

        if self.in_escalate:
            EscalationQueue.objects.filter(addon=self.addon).delete()
        if self.in_rereview:
            RereviewQueue.objects.filter(addon=self.addon).delete()

        self.create_note(amo.LOG.REJECT_VERSION)
        self.notify_email('pending_to_sandbox',
                          u'Your submission has been rejected: %s')

        log.info(u'Making %s disabled' % self.addon)

        # Assign reviewer incentive scores.
        return ReviewerScore.award_points(self.request.amo_user,
                                          self.addon,
                                          status,
                                          in_rereview=self.in_rereview)
Exemplo n.º 37
0
 def _give_points(self, user=None, addon=None, status=None):
     user = user or self.user
     addon = addon or self.addon
     ReviewerScore.award_points(user, addon, status or addon.status)
Exemplo n.º 38
0
    def save(self):
        action = self.cleaned_data['action']
        comment = self.cleaned_data.get('comment')
        reject_reason = self.cleaned_data.get('reject_reason')
        theme = self.cleaned_data['theme']

        is_rereview = (theme.rereviewqueuetheme_set.exists()
                       and theme.addon.status
                       not in (amo.STATUS_PENDING, amo.STATUS_REVIEW_PENDING))

        theme_lock = ThemeLock.objects.get(theme=self.cleaned_data['theme'])

        mail_and_log = True
        if action == rvw.ACTION_APPROVE:
            if is_rereview:
                approve_rereview(theme)
            theme.addon.update(status=amo.STATUS_PUBLIC)
            theme.approve = datetime.datetime.now()
            theme.save()

        elif action == rvw.ACTION_REJECT:
            if is_rereview:
                reject_rereview(theme)
            else:
                theme.addon.update(status=amo.STATUS_REJECTED)

        elif action == rvw.ACTION_DUPLICATE:
            if is_rereview:
                reject_rereview(theme)
            else:
                theme.addon.update(status=amo.STATUS_REJECTED)

        elif action == rvw.ACTION_FLAG:
            if is_rereview:
                mail_and_log = False
            else:
                theme.addon.update(status=amo.STATUS_REVIEW_PENDING)

        elif action == rvw.ACTION_MOREINFO:
            if not is_rereview:
                theme.addon.update(status=amo.STATUS_REVIEW_PENDING)

        if mail_and_log:
            send_mail(self.cleaned_data, theme_lock)

            # Log.
            amo.log(amo.LOG.THEME_REVIEW,
                    theme.addon,
                    details={
                        'theme': theme.addon.name.localized_string,
                        'action': action,
                        'reject_reason': reject_reason,
                        'comment': comment
                    },
                    user=theme_lock.reviewer)
            log.info('%sTheme %s (%s) - %s' %
                     ('[Rereview] ' if is_rereview else '', theme.addon.name,
                      theme.id, action))

        score = 0
        if action not in [rvw.ACTION_MOREINFO, rvw.ACTION_FLAG]:
            score = ReviewerScore.award_points(theme_lock.reviewer,
                                               theme.addon, theme.addon.status)
        theme_lock.delete()

        return score
Exemplo n.º 39
0
 def _give_points(self, user=None, addon=None, status=None):
     user = user or self.user
     addon = addon or self.addon
     ReviewerScore.award_points(user, addon, status or addon.status)
Exemplo n.º 40
0
 def _give_points(self, user=None, addon=None, event=None):
     user = user or self.user
     addon = addon or self.addon
     event = event or amo.REVIEWED_ADDON_FULL
     ReviewerScore.award_points(user, addon, event)