Esempio n. 1
0
    def _process_public(self, status):
        """Changes status to a publicly viewable status."""
        if self.addon.has_incomplete_status():
            # Failsafe.
            return

        self.addon.sign_if_packaged(self.version.pk)
        # 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())
        # If app is already an approved status, don't change it when approving
        # a version.
        if self.addon.status not in amo.WEBAPPS_APPROVED_STATUSES:
            self.set_addon(status=status, highest_status=status)
        self.set_reviewed()

        set_storefront_data.delay(self.addon.pk)

        self.create_note(amo.LOG.APPROVE_VERSION)
        if status == amo.STATUS_PUBLIC:
            self.notify_email('pending_to_public', u'App approved: %s')
        elif status == amo.STATUS_UNLISTED:
            self.notify_email('pending_to_unlisted',
                              u'App approved but unlisted: %s')

        log.info(u'Making %s public' % self.addon)
Esempio n. 2
0
    def _process_public(self, status):
        """Changes status to a publicly viewable status."""
        if self.addon.has_incomplete_status():
            # Failsafe.
            return

        self.addon.sign_if_packaged(self.version.pk)
        # 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())
        # If app is already an approved status, don't change it when approving
        # a version.
        if self.addon.status not in amo.WEBAPPS_APPROVED_STATUSES:
            self.set_addon(status=status, highest_status=status)
        self.set_reviewed()

        set_storefront_data.delay(self.addon.pk)

        self.create_note(amo.LOG.APPROVE_VERSION)
        if status == amo.STATUS_PUBLIC:
            self.notify_email('pending_to_public', u'App approved: %s')
        elif status == amo.STATUS_UNLISTED:
            self.notify_email('pending_to_unlisted',
                              u'App approved but unlisted: %s')

        log.info(u'Making %s public' % self.addon)
Esempio n. 3
0
    def process_disable(self):
        """
        Bans app from Marketplace, clears app from all queues.
        Changes status to Disabled.
        Creates Banned/Disabled note.
        """
        if not acl.action_allowed(self.request, 'Apps', 'Edit'):
            return

        # Disable disables all files, not just those in this version.
        self.set_files(mkt.STATUS_DISABLED,
                       File.objects.filter(version__addon=self.addon),
                       hide_disabled_file=True)
        self.addon.update(status=mkt.STATUS_DISABLED)
        if self.in_escalate:
            EscalationQueue.objects.filter(addon=self.addon).delete()
        if self.in_rereview:
            RereviewQueue.objects.filter(addon=self.addon).delete()

        if waffle.switch_is_active('iarc-upgrade-v2'):
            iarc_unpublish.delay(self.addon.pk)
        else:
            set_storefront_data.delay(self.addon.pk, disable=True)

        self.create_note(mkt.LOG.APP_DISABLED)
        log.info(u'App %s has been banned by a reviewer.' % self.addon)
Esempio n. 4
0
    def process_disable(self):
        """
        Bans app from Marketplace, clears app from all queues.
        Changes status to Disabled.
        Creates Banned/Disabled note.
        """
        if not acl.action_allowed(self.request, 'Apps', 'Edit'):
            return

        # Disable disables all files, not just those in this version.
        self.set_files(mkt.STATUS_DISABLED,
                       File.objects.filter(version__addon=self.addon),
                       hide_disabled_file=True)
        self.addon.update(status=mkt.STATUS_DISABLED)
        if self.in_escalate:
            EscalationQueue.objects.filter(addon=self.addon).delete()
        if self.in_rereview:
            RereviewQueue.objects.filter(addon=self.addon).delete()

        if waffle.switch_is_active('iarc-upgrade-v2'):
            iarc_unpublish.delay(self.addon.pk)
        else:
            set_storefront_data.delay(self.addon.pk, disable=True)

        self.create_note(mkt.LOG.APP_DISABLED)
        log.info(u'App %s has been banned by a reviewer.' % self.addon)
Esempio n. 5
0
def publicise(request, addon_id, addon):
    if addon.status == amo.STATUS_APPROVED:
        addon.update(status=amo.STATUS_PUBLIC)
        File.objects.filter(version__addon=addon, status=amo.STATUS_APPROVED).update(status=amo.STATUS_PUBLIC)
        amo.log(amo.LOG.CHANGE_STATUS, addon.get_status_display(), addon)
        # Call update_version, so various other bits of data update.
        addon.update_version()
        # Call to update names and locales if changed.
        addon.update_name_from_package_manifest()
        addon.update_supported_locales()

        set_storefront_data.delay(addon.pk)

    return redirect(addon.get_dev_url("versions"))
Esempio n. 6
0
    def save(self):
        publish = self.cleaned_data["publish_type"]
        limited = self.cleaned_data["limited"]

        if publish == mkt.PUBLISH_HIDDEN and limited:
            publish = mkt.PUBLISH_PRIVATE

        status = self.STATUS_MAPPING[publish]
        self.addon.update(status=status)

        mkt.log(mkt.LOG.CHANGE_STATUS, self.addon.get_status_display(), self.addon)
        # Call update_version, so various other bits of data update.
        self.addon.update_version()
        # Call to update names and locales if changed.
        self.addon.update_name_from_package_manifest()
        self.addon.update_supported_locales()

        set_storefront_data.delay(self.addon.pk)
Esempio n. 7
0
    def save(self):
        publish = self.cleaned_data['publish_type']
        limited = self.cleaned_data['limited']

        if publish == mkt.PUBLISH_HIDDEN and limited:
            publish = mkt.PUBLISH_PRIVATE

        status = self.STATUS_MAPPING[publish]
        self.addon.update(status=status)

        mkt.log(mkt.LOG.CHANGE_STATUS, self.addon.get_status_display(),
                self.addon)
        # Call update_version, so various other bits of data update.
        self.addon.update_version()
        # Call to update names and locales if changed.
        self.addon.update_name_from_package_manifest()
        self.addon.update_supported_locales()

        set_storefront_data.delay(self.addon.pk)
Esempio n. 8
0
    def _process_public(self, status):
        """Changes status to a publicly viewable status."""
        if self.webapp.has_incomplete_status():
            # Failsafe.
            return

        self.webapp.sign_if_packaged(self.version.pk)
        # Save files first, because set_webapp checks to make sure there
        # is at least one public file or it won't make the webapp public.
        self.set_files(mkt.STATUS_PUBLIC, self.version.files.all())
        # If app is already an approved status, don't change it when approving
        # a version.
        if self.webapp.status not in mkt.WEBAPPS_APPROVED_STATUSES:
            self.set_webapp(status=status, highest_status=status)
        self.set_reviewed()

        set_storefront_data.delay(self.webapp.pk)

        self.create_note(mkt.LOG.APPROVE_VERSION)

        log.info(u'Making %s public' % self.webapp)
Esempio n. 9
0
    def save(self):
        publish = self.cleaned_data['publish_type']
        limited = self.cleaned_data['limited']

        if publish == mkt.PUBLISH_HIDDEN and limited:
            publish = mkt.PUBLISH_PRIVATE

        status = self.STATUS_MAPPING[publish]
        self.addon.update(status=status)

        mkt.log(mkt.LOG.CHANGE_STATUS, self.addon.get_status_display(),
                self.addon)
        # Call update_version, so various other bits of data update.
        self.addon.update_version()
        # Call to update names and locales if changed.
        self.addon.update_name_from_package_manifest()
        self.addon.update_supported_locales()

        if waffle.switch_is_active('iarc-upgrade-v2'):
            iarc_publish.delay(self.addon.pk)
        else:
            set_storefront_data.delay(self.addon.pk)
Esempio n. 10
0
    def process_disable(self):
        """
        Disables app, clears app from all queues.
        Changes status to Disabled.
        Creates Disabled note/email.
        """
        if not acl.action_allowed(self.request, 'Apps', 'Edit'):
            return

        # Disable disables all files, not just those in this version.
        self.set_files(amo.STATUS_DISABLED,
                       File.objects.filter(version__addon=self.addon),
                       hide_disabled_file=True)
        self.addon.update(status=amo.STATUS_DISABLED)
        if self.in_escalate:
            EscalationQueue.objects.filter(addon=self.addon).delete()
        if self.in_rereview:
            RereviewQueue.objects.filter(addon=self.addon).delete()

        set_storefront_data.delay(self.addon.pk, disable=True)

        self.notify_email('disabled', u'App disabled by reviewer: %s')
        self.create_note(amo.LOG.APP_DISABLED)
        log.info(u'App %s has been disabled by a reviewer.' % self.addon)
Esempio n. 11
0
    def _process_public(self, status):
        """Changes status to a publicly viewable status."""
        if self.addon.has_incomplete_status():
            # Failsafe.
            return

        self.addon.sign_if_packaged(self.version.pk)
        # 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(mkt.STATUS_PUBLIC, self.version.files.all())
        # If app is already an approved status, don't change it when approving
        # a version.
        if self.addon.status not in mkt.WEBAPPS_APPROVED_STATUSES:
            self.set_addon(status=status, highest_status=status)
        self.set_reviewed()

        if waffle.switch_is_active('iarc-upgrade-v2'):
            iarc_publish.delay(self.addon.pk)
        else:
            set_storefront_data.delay(self.addon.pk)

        self.create_note(mkt.LOG.APPROVE_VERSION)

        log.info(u'Making %s public' % self.addon)
Esempio n. 12
0
    def process_disable(self):
        """
        Bans app from Marketplace, clears app from all queues.
        Changes status to Disabled.
        Creates Banned/Disabled note/email.
        """
        if not acl.action_allowed(self.request, 'Apps', 'Edit'):
            return

        # Disable disables all files, not just those in this version.
        self.set_files(amo.STATUS_DISABLED,
                       File.objects.filter(version__addon=self.addon),
                       hide_disabled_file=True)
        self.addon.update(status=amo.STATUS_DISABLED)
        if self.in_escalate:
            EscalationQueue.objects.filter(addon=self.addon).delete()
        if self.in_rereview:
            RereviewQueue.objects.filter(addon=self.addon).delete()

        set_storefront_data.delay(self.addon.pk, disable=True)

        self.notify_email('disabled', u'App banned by reviewer: %s')
        self.create_note(amo.LOG.APP_DISABLED)
        log.info(u'App %s has been banned by a reviewer.' % self.addon)
Esempio n. 13
0
    def _process_public_immediately(self):
        """Changes status to Public."""
        if self.addon.has_incomplete_status():
            # Failsafe.
            return

        self.addon.sign_if_packaged(self.version.pk)
        # 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())
        if self.addon.status != amo.STATUS_PUBLIC:
            self.set_addon(status=amo.STATUS_PUBLIC,
                           highest_status=amo.STATUS_PUBLIC)
        self.set_reviewed()

        # Note: Post save signals shouldn't happen here. All the set_*()
        # methods pass _signal=False to prevent them from being sent. They are
        # manually triggered in the view after the transaction is committed to
        # avoid multiple indexing tasks getting fired with stale data.
        #
        # This does mean that we need to call update_version() manually to get
        # the addon in the correct state before updating names. We do that,
        # passing _signal=False again to prevent it from sending
        # 'version_changed'. The post_save() that happen in the view will
        # call it without that parameter, sending 'version_changed' normally.
        self.addon.update_version(_signal=False)
        self.addon.update_name_from_package_manifest()
        self.addon.update_supported_locales()
        self.addon.resend_version_changed_signal = True

        set_storefront_data.delay(self.addon.pk)

        self.create_note(amo.LOG.APPROVE_VERSION)
        self.notify_email('pending_to_public', u'App approved: %s')

        log.info(u'Making %s public' % self.addon)
Esempio n. 14
0
    def _process_public(self, status):
        """Changes status to a publicly viewable status."""
        if self.addon.has_incomplete_status():
            # Failsafe.
            return

        self.addon.sign_if_packaged(self.version.pk)
        # 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(mkt.STATUS_PUBLIC, self.version.files.all())
        # If app is already an approved status, don't change it when approving
        # a version.
        if self.addon.status not in mkt.WEBAPPS_APPROVED_STATUSES:
            self.set_addon(status=status, highest_status=status)
        self.set_reviewed()

        if waffle.switch_is_active("iarc-upgrade-v2"):
            iarc_publish.delay(self.addon.pk)
        else:
            set_storefront_data.delay(self.addon.pk)

        self.create_note(mkt.LOG.APPROVE_VERSION)

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