issue:7340-remove all the code related to multi-process status except message ids in django.po files (In locale folder)

This commit is contained in:
ajupazhamayil 2018-12-11 15:51:43 +05:30
Родитель c0a21d5992
Коммит 72c930b262
18 изменённых файлов: 6 добавлений и 341 удалений

Просмотреть файл

@ -394,34 +394,6 @@ This endpoint allows you to fetch a single version belonging to a specific add-o
:>json string version: The version number string for the version.
----------------------------
Add-on Feature Compatibility
----------------------------
.. _addon-feature-compatibility:
This endpoint allows you to fetch feature compatibility information for a
a specific add-on by id, slug or guid.
.. http:get:: /api/v4/addons/addon/(int:id|string:slug|string:guid)/feature_compatibility/
.. note::
Non-public add-ons and add-ons with only unlisted versions require both:
* authentication
* reviewer permissions or an account listed as a developer of the add-on
:>json int e10s: The add-on e10s compatibility. Can be one of the following:
======================= ==========================================================
Value Description
======================= ==========================================================
compatible multiprocessCompatible marked as true in the install.rdf.
compatible-webextension A WebExtension, so compatible.
incompatible multiprocessCompatible marked as false in the install.rdf.
unknown multiprocessCompatible has not been set.
======================= ==========================================================
------------------------------
Add-on EULA and Privacy Policy
------------------------------

Просмотреть файл

@ -388,34 +388,6 @@ This endpoint allows you to fetch a single version belonging to a specific add-o
:>json string version: The version number string for the version.
----------------------------
Add-on Feature Compatibility
----------------------------
.. _v3-addon-feature-compatibility:
This endpoint allows you to fetch feature compatibility information for a
a specific add-on by id, slug or guid.
.. http:get:: /api/v3/addons/addon/(int:id|string:slug|string:guid)/feature_compatibility/
.. note::
Non-public add-ons and add-ons with only unlisted versions require both:
* authentication
* reviewer permissions or an account listed as a developer of the add-on
:>json int e10s: The add-on e10s compatibility. Can be one of the following:
======================= ==========================================================
Value Description
======================= ==========================================================
compatible multiprocessCompatible marked as true in the install.rdf.
compatible-webextension A WebExtension, so compatible.
incompatible multiprocessCompatible marked as false in the install.rdf.
unknown multiprocessCompatible has not been set.
======================= ==========================================================
------------------------------
Add-on EULA and Privacy Policy
------------------------------

Просмотреть файл

@ -1409,17 +1409,6 @@ class Addon(OnChangeMixin, ModelBase):
dev=(not require_owner),
ignore_disabled=ignore_disabled)
@property
def feature_compatibility(self):
try:
feature_compatibility = self.addonfeaturecompatibility
except AddonFeatureCompatibility.DoesNotExist:
# If it does not exist, return a blank one, no need to create. It's
# the caller responsibility to create when needed to avoid
# unexpected database writes.
feature_compatibility = AddonFeatureCompatibility()
return feature_compatibility
def should_show_permissions(self, version=None):
version = version or self.current_version
return (self.type == amo.ADDON_EXTENSION and
@ -1808,19 +1797,6 @@ def watch_addon_user(old_attr=None, new_attr=None, instance=None, sender=None,
update_search_index(sender=sender, instance=instance.addon, **kwargs)
class AddonFeatureCompatibility(ModelBase):
addon = models.OneToOneField(
Addon, primary_key=True, on_delete=models.CASCADE)
e10s = models.PositiveSmallIntegerField(
choices=amo.E10S_COMPATIBILITY_CHOICES, default=amo.E10S_UNKNOWN)
def __unicode__(self):
return unicode(self.addon) if self.pk else u""
def get_e10s_classname(self):
return amo.E10S_COMPATIBILITY_CHOICES_API[self.e10s]
class AddonApprovalsCounter(ModelBase):
"""Model holding a counter of the number of times a listed version
belonging to an add-on has been approved by a human. Reset everytime a

Просмотреть файл

@ -23,19 +23,10 @@ from olympia.versions.models import (
ApplicationsVersions, License, Version, VersionPreview)
from .models import (
Addon, AddonFeatureCompatibility, CompatOverride, Persona, Preview,
Addon, CompatOverride, Persona, Preview,
ReplacementAddon, attach_tags)
class AddonFeatureCompatibilitySerializer(serializers.ModelSerializer):
e10s = ReverseChoiceField(
choices=amo.E10S_COMPATIBILITY_CHOICES_API.items())
class Meta:
model = AddonFeatureCompatibility
fields = ('e10s', )
class FileSerializer(serializers.ModelSerializer):
url = serializers.SerializerMethodField()
platform = ReverseChoiceField(choices=amo.PLATFORM_CHOICES_API.items())

Просмотреть файл

@ -20,7 +20,7 @@ from olympia.addons import models as addons_models
from olympia.activity.models import ActivityLog, AddonLog
from olympia.addons.models import (
Addon, AddonApprovalsCounter, AddonCategory,
AddonFeatureCompatibility, AddonReviewerFlags, AddonUser, AppSupport,
AddonReviewerFlags, AddonUser, AppSupport,
Category, CompatOverride, CompatOverrideRange, DeniedGuid, DeniedSlug,
FrozenAddon, IncompatibleVersions, MigratedLWT, Persona, Preview,
track_addon_status_change)
@ -1800,21 +1800,6 @@ class TestAddonDelete(TestCase):
assert Addon.unfiltered.filter(pk=addon.pk).exists()
class TestAddonFeatureCompatibility(TestCase):
fixtures = ['base/addon_3615']
def test_feature_compatibility_not_present(self):
addon = Addon.objects.get(pk=3615)
assert addon.feature_compatibility
assert not addon.feature_compatibility.pk
def test_feature_compatibility_present(self):
addon = Addon.objects.get(pk=3615)
AddonFeatureCompatibility.objects.create(addon=addon)
assert addon.feature_compatibility
assert addon.feature_compatibility.pk
class TestUpdateStatus(TestCase):
def test_no_file_ends_with_NULL(self):
@ -2462,54 +2447,6 @@ class TestAddonFromUpload(UploadTest):
parsed_data=parsed_data)
assert e.exception.messages == ['Duplicate add-on ID found.']
def test_basic_extension_is_marked_as_e10s_unknown(self):
# extension.xpi does not have multiprocessCompatible set to true, so
# it's marked as not-compatible.
self.upload = self.get_upload('extension.xpi')
parsed_data = parse_addon(self.upload, user=Mock())
addon = Addon.from_upload(
self.upload, [self.selected_app], parsed_data=parsed_data)
assert addon.guid
feature_compatibility = addon.feature_compatibility
assert feature_compatibility.pk
assert feature_compatibility.e10s == amo.E10S_UNKNOWN
def test_extension_is_marked_as_e10s_incompatible(self):
self.upload = self.get_upload(
'multiprocess_incompatible_extension.xpi')
parsed_data = parse_addon(self.upload, user=Mock())
addon = Addon.from_upload(
self.upload, [self.selected_app], parsed_data=parsed_data)
assert addon.guid
feature_compatibility = addon.feature_compatibility
assert feature_compatibility.pk
assert feature_compatibility.e10s == amo.E10S_INCOMPATIBLE
def test_multiprocess_extension_is_marked_as_e10s_compatible(self):
self.upload = self.get_upload(
'multiprocess_compatible_extension.xpi')
parsed_data = parse_addon(self.upload, user=Mock())
addon = Addon.from_upload(
self.upload, [self.selected_app], parsed_data=parsed_data)
assert addon.guid
feature_compatibility = addon.feature_compatibility
assert feature_compatibility.pk
assert feature_compatibility.e10s == amo.E10S_COMPATIBLE
def test_webextension_is_marked_as_e10s_compatible(self):
self.upload = self.get_upload('webextension.xpi')
parsed_data = parse_addon(self.upload, user=Mock())
addon = Addon.from_upload(
self.upload, [self.selected_app], parsed_data=parsed_data)
assert addon.guid
feature_compatibility = addon.feature_compatibility
assert feature_compatibility.pk
assert feature_compatibility.e10s == amo.E10S_COMPATIBLE_WEBEXTENSION
def test_webextension_resolve_translations(self):
self.upload = self.get_upload('notify-link-clicks-i18n.xpi')
parsed_data = parse_addon(self.upload, user=Mock())
@ -2534,7 +2471,6 @@ class TestAddonFromUpload(UploadTest):
"""Make sure we correct invalid `default_locale` values"""
parsed_data = {
'default_locale': u'sv',
'e10s_compatibility': 2,
'guid': u'notify-link-clicks-i18n@notzilla.org',
'name': u'__MSG_extensionName__',
'is_webextension': True,
@ -2558,7 +2494,6 @@ class TestAddonFromUpload(UploadTest):
"""
parsed_data = {
'default_locale': u'xxx',
'e10s_compatibility': 2,
'guid': u'notify-link-clicks-i18n@notzilla.org',
'name': u'__MSG_extensionName__',
'is_webextension': True,

Просмотреть файл

@ -21,7 +21,7 @@ from rest_framework.test import APIRequestFactory
from olympia import amo
from olympia.abuse.models import AbuseReport
from olympia.addons.models import (
Addon, AddonFeatureCompatibility, AddonUser, Category,
Addon, AddonUser, Category,
CompatOverride, CompatOverrideRange, Persona, ReplacementAddon,
AddonCategory)
from olympia.addons.utils import generate_addon_guid
@ -2152,41 +2152,6 @@ class TestVersionViewSetList(AddonAndVersionViewSetDetailMixin, TestCase):
assert response.status_code == 403
class TestAddonViewSetFeatureCompatibility(TestCase):
client_class = APITestClient
def setUp(self):
super(TestAddonViewSetFeatureCompatibility, self).setUp()
self.addon = addon_factory(
guid=generate_addon_guid(), name=u'My Addôn', slug='my-addon')
self.url = reverse_ns(
'addon-feature-compatibility', kwargs={'pk': self.addon.pk})
def test_url(self):
self.detail_url = reverse_ns(
'addon-detail', kwargs={'pk': self.addon.pk})
assert self.url == '%s%s' % (self.detail_url, 'feature_compatibility/')
def test_disabled_anonymous(self):
self.addon.update(disabled_by_user=True)
response = self.client.get(self.url)
assert response.status_code == 401
def test_feature_compatibility_unknown(self):
response = self.client.get(self.url)
assert response.status_code == 200
data = json.loads(response.content)
assert data['e10s'] == 'unknown'
def test_feature_compatibility_compatible(self):
AddonFeatureCompatibility.objects.create(
addon=self.addon, e10s=amo.E10S_COMPATIBLE)
response = self.client.get(self.url)
assert response.status_code == 200
data = json.loads(response.content)
assert data['e10s'] == 'compatible'
class TestAddonViewSetEulaPolicy(TestCase):
client_class = APITestClient

Просмотреть файл

@ -53,7 +53,7 @@ from .indexers import AddonIndexer
from .models import (
Addon, CompatOverride, FrozenAddon, Persona, ReplacementAddon)
from .serializers import (
AddonEulaPolicySerializer, AddonFeatureCompatibilitySerializer,
AddonEulaPolicySerializer,
AddonSerializer, AddonSerializerWithUnlistedData, CompatOverrideSerializer,
ESAddonAutoCompleteSerializer, ESAddonSerializer, LanguageToolsSerializer,
ReplacementAddonSerializer, StaticCategorySerializer, VersionSerializer)
@ -500,14 +500,6 @@ class AddonViewSet(RetrieveModelMixin, GenericViewSet):
}
raise exc
@action(detail=True)
def feature_compatibility(self, request, pk=None):
obj = self.get_object()
serializer = AddonFeatureCompatibilitySerializer(
obj.feature_compatibility,
context=self.get_serializer_context())
return Response(serializer.data)
@action(detail=True)
def eula_policy(self, request, pk=None):
obj = self.get_object()

Просмотреть файл

@ -434,27 +434,6 @@ DEFAULT_STATIC_THEME_MIN_VERSION_ANDROID = '65.0'
DEFAULT_WEBEXT_DICT_MIN_VERSION_FIREFOX = '61.0'
E10S_UNKNOWN = 0
E10S_COMPATIBLE = 1
E10S_COMPATIBLE_WEBEXTENSION = 2
E10S_INCOMPATIBLE = 3
E10S_COMPATIBILITY_CHOICES = (
(E10S_UNKNOWN, _('Unknown')),
# We don't need to show developers the actual, more granular state, only
# that it's compatible or not.
(E10S_COMPATIBLE_WEBEXTENSION, _('Compatible')),
(E10S_COMPATIBLE, _('Compatible')),
(E10S_INCOMPATIBLE, _('Incompatible')),
)
E10S_COMPATIBILITY_CHOICES_API = {
E10S_UNKNOWN: 'unknown',
E10S_COMPATIBLE_WEBEXTENSION: 'compatible-webextension',
E10S_COMPATIBLE: 'compatible',
E10S_INCOMPATIBLE: 'incompatible',
}
ADDON_GUID_PATTERN = re.compile(
# Match {uuid} or something@host.tld ("something" being optional)
# guids. Copied from mozilla-central XPIProvider.jsm.

Просмотреть файл

@ -44,13 +44,6 @@
{{ addon.last_updated|date }}
</li>
{% endif %}
{% if addon.type == amo.ADDON_EXTENSION and amo.FIREFOX in addon.compatible_apps %}
<li class="e10s-compatibility e10s-{{ addon.feature_compatibility.get_e10s_classname() }}">
<strong>{{ _('Add-on Multi Process Status:') }}</strong>
<b>{{ addon.feature_compatibility.get_e10s_display() }}</b>
<span class="tip tooltip" title="{{ _('Your add-on compatibility with Multi Process Firefox (e10s)') }}">?</span>
</li>
{% endif %}
{% if addon.has_listed_versions() %}
{% if addon.has_unlisted_versions() %}

Просмотреть файл

@ -23,7 +23,7 @@ from waffle.testutils import override_switch
from olympia import amo, core
from olympia.activity.models import ActivityLog
from olympia.addons.models import (
Addon, AddonCategory, AddonFeatureCompatibility, AddonUser)
Addon, AddonCategory, AddonUser)
from olympia.amo.storage_utils import copy_stored_file
from olympia.amo.templatetags.jinja_helpers import (
format_date, url as url_reverse)
@ -205,30 +205,6 @@ class TestDashboard(HubTest):
appver = self.addon.current_version.apps.all()[0]
appver.delete()
# Addon is not set to be compatible with Firefox, e10s compatibility is
# not shown.
doc = pq(self.client.get(self.url).content)
item = doc('.item[data-addonid="%s"]' % self.addon.id)
assert not item.find('.e10s-compatibility')
def test_e10s_compatibility(self):
self.addon = addon_factory(name=u'My Addœn')
self.addon.addonuser_set.create(user=self.user_profile)
doc = pq(self.client.get(self.url).content)
item = doc('.item[data-addonid="%s"]' % self.addon.id)
e10s_flag = item.find('.e10s-compatibility.e10s-unknown b')
assert e10s_flag
assert e10s_flag.text() == 'Unknown'
AddonFeatureCompatibility.objects.create(
addon=self.addon, e10s=amo.E10S_COMPATIBLE)
doc = pq(self.client.get(self.url).content)
item = doc('.item[data-addonid="%s"]' % self.addon.id)
assert not item.find('.e10s-compatibility.e10s-unknown')
e10s_flag = item.find('.e10s-compatibility.e10s-compatible b')
assert e10s_flag
assert e10s_flag.text() == 'Compatible'
def test_dev_news(self):
for i in xrange(7):

Просмотреть файл

@ -129,11 +129,6 @@ def dashboard(request, theme=False):
theme=theme, addon_items=addon_items)
if data['addon_tab']:
addons, data['filter'] = addon_listing(request)
# We know the dashboard is going to want to display feature
# compatibility. Unfortunately, cache-machine doesn't obey
# select_related properly, so to avoid the extra queries we do the next
# best thing, prefetch_related, which works fine with cache-machine.
addons = addons.prefetch_related('addonfeaturecompatibility')
data['addons'] = amo_utils.paginate(request, addons, per_page=10)
if theme:

Двоичный файл не отображается.

Просмотреть файл

@ -286,10 +286,6 @@ class TestManifestJSONExtractor(TestCase):
assert self.parse({'theme': {}})['type'] == amo.ADDON_STATICTHEME
def test_is_e10s_compatible(self):
data = self.parse({})
assert data['e10s_compatibility'] == amo.E10S_COMPATIBLE_WEBEXTENSION
def test_langpack(self):
self.create_webext_default_versions()
self.create_appversion('firefox', '60.0')

Просмотреть файл

@ -257,13 +257,6 @@ class RDFExtractor(object):
# `experiment` is detected in in `find_type`.
data['is_experiment'] = self.is_experiment
multiprocess_compatible = self.find('multiprocessCompatible')
if multiprocess_compatible == 'true':
data['e10s_compatibility'] = amo.E10S_COMPATIBLE
elif multiprocess_compatible == 'false':
data['e10s_compatibility'] = amo.E10S_INCOMPATIBLE
else:
data['e10s_compatibility'] = amo.E10S_UNKNOWN
return data
def find_type(self):
@ -563,7 +556,6 @@ class ManifestJSONExtractor(object):
data.update({
'is_restart_required': False,
'apps': list(self.apps()),
'e10s_compatibility': amo.E10S_COMPATIBLE_WEBEXTENSION,
# Langpacks have strict compatibility enabled, rest of
# webextensions don't.
'strict_compatibility': data['type'] == amo.ADDON_LPAPP,

Просмотреть файл

@ -1,8 +0,0 @@
CREATE TABLE `addons_addonfeaturecompatibility` (
`created` datetime NOT NULL,
`modified` datetime NOT NULL,
`addon_id` int(11) UNSIGNED NOT NULL PRIMARY KEY,
`e10s` smallint UNSIGNED NOT NULL
)
;
ALTER TABLE `addons_addonfeaturecompatibility` ADD CONSTRAINT `addon_id_refs_id_7779cd14` FOREIGN KEY (`addon_id`) REFERENCES `addons` (`id`);

Просмотреть файл

@ -174,8 +174,6 @@ class Version(OnChangeMixin, ModelBase):
"""
assert parsed_data is not None
from olympia.addons.models import AddonFeatureCompatibility
if addon.status == amo.STATUS_DISABLED:
raise VersionCreateError(
'Addon is Mozilla Disabled; no new versions are allowed.')
@ -200,14 +198,6 @@ class Version(OnChangeMixin, ModelBase):
log.info(
'New version: %r (%s) from %r' % (version, version.id, upload))
activity.log_create(amo.LOG.ADD_VERSION, version, addon)
# Update the add-on e10s compatibility since we're creating a new
# version that may change that.
e10s_compatibility = parsed_data.get('e10s_compatibility')
if e10s_compatibility is not None:
feature_compatibility = (
AddonFeatureCompatibility.objects.get_or_create(addon=addon)[0]
)
feature_compatibility.update(e10s=e10s_compatibility)
if addon.type == amo.ADDON_STATICTHEME:
# We don't let developers select apps for static themes

Просмотреть файл

@ -14,7 +14,7 @@ from waffle.testutils import override_switch
from olympia import amo, core
from olympia.activity.models import ActivityLog
from olympia.addons.models import (
Addon, AddonFeatureCompatibility, AddonReviewerFlags, CompatOverride,
Addon, AddonReviewerFlags, CompatOverride,
CompatOverrideRange)
from olympia.amo.tests import (
TestCase, addon_factory, version_factory, user_factory)
@ -817,48 +817,6 @@ class TestExtensionVersionFromUpload(TestVersionFromUpload):
assert (actual_delta >= (rough_delta - fuzz) and
actual_delta <= (rough_delta + fuzz))
def test_new_version_is_10s_compatible_no_feature_compat_previously(self):
assert not self.addon.feature_compatibility.pk
self.upload = self.get_upload('multiprocess_compatible_extension.xpi')
parsed_data = parse_addon(self.upload, self.addon, user=mock.Mock())
version = Version.from_upload(
self.upload, self.addon, [self.selected_app],
amo.RELEASE_CHANNEL_LISTED,
parsed_data=parsed_data)
assert version.pk
assert self.addon.feature_compatibility.pk
assert self.addon.feature_compatibility.e10s == amo.E10S_COMPATIBLE
def test_new_version_is_10s_compatible(self):
AddonFeatureCompatibility.objects.create(addon=self.addon)
assert self.addon.feature_compatibility.e10s == amo.E10S_UNKNOWN
self.upload = self.get_upload('multiprocess_compatible_extension.xpi')
parsed_data = parse_addon(self.upload, self.addon, user=mock.Mock())
version = Version.from_upload(
self.upload, self.addon, [self.selected_app],
amo.RELEASE_CHANNEL_LISTED,
parsed_data=parsed_data)
assert version.pk
assert self.addon.feature_compatibility.pk
self.addon.feature_compatibility.reload()
assert self.addon.feature_compatibility.e10s == amo.E10S_COMPATIBLE
def test_new_version_is_webextension(self):
self.addon.update(guid='@webextension-guid')
AddonFeatureCompatibility.objects.create(addon=self.addon)
assert self.addon.feature_compatibility.e10s == amo.E10S_UNKNOWN
self.upload = self.get_upload('webextension.xpi')
parsed_data = parse_addon(self.upload, self.addon, user=mock.Mock())
version = Version.from_upload(
self.upload, self.addon, [self.selected_app],
amo.RELEASE_CHANNEL_LISTED,
parsed_data=parsed_data)
assert version.pk
assert self.addon.feature_compatibility.pk
self.addon.feature_compatibility.reload()
assert self.addon.feature_compatibility.e10s == (
amo.E10S_COMPATIBLE_WEBEXTENSION)
def test_nomination_inherited_for_updates(self):
assert self.addon.status == amo.STATUS_PUBLIC
self.addon.current_version.update(nomination=self.days_ago(2))

Просмотреть файл

@ -50,15 +50,6 @@
color: #329902;
}
.e10s-compatible b,
.e10s-compatible-webextension b {
color: #329902;
}
.e10s-unknown b {
color: #FFA400;
}
.html-rtl.developer-hub {
.menu-nav {
margin-right: 0;