Update due dates on an add-on when doing a listed approval/confirm approval (#20308)

This commit is contained in:
Mathieu Pillard 2023-02-07 18:23:45 +01:00 коммит произвёл GitHub
Родитель 1a6557345f
Коммит 94b9a0e714
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 18 добавлений и 0 удалений

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

@ -1497,11 +1497,26 @@ class TestReviewHelper(TestReviewHelperBase):
def test_addon_with_version_need_human_review_confirm_auto_approval(self): def test_addon_with_version_need_human_review_confirm_auto_approval(self):
self.addon.current_version.update(needs_human_review=True) self.addon.current_version.update(needs_human_review=True)
assert self.addon.current_version.due_date
self.test_public_addon_confirm_auto_approval() self.test_public_addon_confirm_auto_approval()
self.addon.current_version.reload() self.addon.current_version.reload()
assert self.addon.current_version.needs_human_review is False assert self.addon.current_version.needs_human_review is False
assert not self.addon.current_version.due_date
assert self.addon.current_version.human_review_date assert self.addon.current_version.human_review_date
def test_addon_with_old_versions_needing_human_review_confirm_auto_approval(self):
previous_version = self.addon.current_version
self.addon.current_version.update(needs_human_review=True)
assert self.addon.current_version.due_date
self.review_version = version_factory(addon=self.addon)
self.test_public_addon_confirm_auto_approval()
self.review_version.reload()
previous_version.reload()
assert not self.review_version.needs_human_review
assert not self.review_version.due_date
assert not previous_version.needs_human_review
assert not previous_version.due_date
def test_addon_with_version_and_scanner_flag_confirm_auto_approvals(self): def test_addon_with_version_and_scanner_flag_confirm_auto_approvals(self):
flags = version_review_flags_factory( flags = version_review_flags_factory(
version=self.addon.current_version, version=self.addon.current_version,

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

@ -813,6 +813,9 @@ class ReviewBase:
version__addon=self.addon, version__addon=self.addon,
version__channel=self.version.channel, version__channel=self.version.channel,
).update(needs_human_review_by_mad=False) ).update(needs_human_review_by_mad=False)
# Trigger a check of all due dates on the add-on since we mass-updated
# versions.
self.addon.update_all_due_dates()
# Also reset it on self.version in case this instance is saved later. # Also reset it on self.version in case this instance is saved later.
self.version.needs_human_review = False self.version.needs_human_review = False