Show pending promoted addons in other reviews queue (#15167)

This commit is contained in:
Andrew Williamson 2020-08-04 16:21:30 +01:00 коммит произвёл GitHub
Родитель 9fc50a1999
Коммит a482f322f0
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 35 добавлений и 4 удалений

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

@ -23,7 +23,7 @@ from olympia.amo.models import ModelBase
from olympia.amo.templatetags.jinja_helpers import absolutify
from olympia.amo.urlresolvers import reverse
from olympia.amo.utils import cache_ns_key, send_mail
from olympia.constants.promoted import RECOMMENDED
from olympia.constants.promoted import RECOMMENDED, PRE_REVIEW_GROUPS
from olympia.files.models import FileValidation
from olympia.ratings.models import Rating
from olympia.reviewers.sql_model import RawSQLModel
@ -243,12 +243,15 @@ class ExtensionQueueMixin:
types = _int_join(
set(amo.GROUP_TYPE_ADDON) - {amo.ADDON_SEARCH})
flags_table = 'addons_addonreviewerflags'
promoted_groups = _int_join(
group.id for group in PRE_REVIEW_GROUPS)
query['where'].append(
f'((addons.addontype_id IN ({types}) '
'AND files.is_webextension = 0) '
f'OR {flags_table}.auto_approval_disabled = 1 '
f'OR {flags_table}.auto_approval_disabled_until_next_approval = 1 '
f'OR {flags_table}.auto_approval_delayed_until > NOW()'
f'OR {flags_table}.auto_approval_delayed_until > NOW() '
f'OR promoted.group_id IN ({promoted_groups})'
')'
)
return query

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

@ -274,8 +274,11 @@ class TestRecommendedQueue(TestQueue):
addon_status=amo.STATUS_APPROVED, file_status=amo.STATUS_APPROVED,
name='No updates')
PromotedAddon.objects.get(
addon=self.new_addon(name='Not promoted')).update(
addon=self.new_addon(name='Not recommended')).update(
group_id=NOT_PROMOTED.id)
PromotedAddon.objects.get(
addon=self.new_addon(name='Promoted but not recommended')).update(
group_id=LINE.id)
PromotedAddon.objects.get(
addon=self.new_addon(name='Not discovery item')).delete()

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

@ -40,7 +40,7 @@ from olympia.amo.tests import (
initial, reverse_ns, user_factory, version_factory)
from olympia.amo.urlresolvers import reverse
from olympia.blocklist.models import Block, BlocklistSubmission
from olympia.constants.promoted import RECOMMENDED
from olympia.constants.promoted import LINE, RECOMMENDED, SPOTLIGHT, STRATEGIC
from olympia.constants.reviewers import (
REVIEWER_DELAYED_REJECTION_PERIOD_DAYS_DEFAULT)
from olympia.constants.scanners import MAD
@ -1658,6 +1658,31 @@ class TestExtensionQueue(QueueTest):
self.addons['Nominated One'], self.addons['Pending One']]
self._test_results()
def test_promoted_addon_in_pre_review_group_does_show_up(self):
self.addons['Pending Two'].find_latest_version(
channel=amo.RELEASE_CHANNEL_LISTED).files.update(
is_webextension=True)
self.addons['Nominated Two'].find_latest_version(
channel=amo.RELEASE_CHANNEL_LISTED).files.update(
is_webextension=True)
self.addons['Pending One'].find_latest_version(
channel=amo.RELEASE_CHANNEL_LISTED).files.update(
is_webextension=True)
self.addons['Nominated One'].find_latest_version(
channel=amo.RELEASE_CHANNEL_LISTED).files.update(
is_webextension=True)
self.make_addon_promoted(self.addons['Pending One'], group=LINE)
self.make_addon_promoted(self.addons['Nominated One'], group=SPOTLIGHT)
# STRATEGIC isn't a pre_review group so won't show up
self.make_addon_promoted(self.addons['Nominated Two'], group=STRATEGIC)
# RECOMMENDED is pre_review, but is handled in it's own queue
self.make_addon_promoted(self.addons['Pending Two'], group=RECOMMENDED)
self.expected_addons = [
self.addons['Nominated One'], self.addons['Pending One']]
self._test_results()
def test_static_theme_filtered_out(self):
self.addons['Pending Two'].update(type=amo.ADDON_STATICTHEME)
self.addons['Nominated Two'].update(type=amo.ADDON_STATICTHEME)