Make it possible to fully delete unlisted/unrated extensions #81

Merged
Anna Sirota merged 24 commits from fully-delete-extension into main 2024-04-19 11:00:19 +02:00
2 changed files with 9 additions and 3 deletions
Showing only changes of commit 42f1d92296 - Show all commits

View File

@ -26,6 +26,7 @@ from extensions.forms import (
from extensions.models import Extension, Version
from files.forms import FileForm
from files.models import File
from reviewers.models import ApprovalActivity
from stats.models import ExtensionView
import ratings.models
@ -408,10 +409,17 @@ class DraftExtensionView(
# Send the extension and version to the review
if 'submit_draft' in self.request.POST:
extension_form.instance.status = extension_form.instance.STATUSES.AWAITING_REVIEW
# FIXME create ApprovalActivity
extension_form.save()
add_preview_formset.save()
form.save()
if 'submit_draft' in self.request.POST:
# TODO allow to submit a custom message via the form
ApprovalActivity(
user=self.request.user,
extension=extension_form.instance,
type=ApprovalActivity.ActivityType.AWAITING_REVIEW,
message="initial submission",
).save()
return super().form_valid(form)
except forms.ValidationError as e:
if 'hash' in e.error_dict:

View File

@ -1,5 +1,4 @@
from pathlib import Path
import unittest
from django.test import TestCase
from django.urls import reverse
@ -48,7 +47,6 @@ class TestTasks(TestCase):
new_notification_nr = Notification.objects.filter(recipient=moderator).count()
self.assertEqual(new_notification_nr, notification_nr + 1)
@unittest.skip('FIXME in DraftExtensionView')
def test_new_extension_submitted(self):
moderator = create_moderator()
notification_nr = Notification.objects.filter(recipient=moderator).count()