Make it possible to fully delete unlisted/unrated extensions #81
@ -26,6 +26,7 @@ from extensions.forms import (
|
|||||||
from extensions.models import Extension, Version
|
from extensions.models import Extension, Version
|
||||||
from files.forms import FileForm
|
from files.forms import FileForm
|
||||||
from files.models import File
|
from files.models import File
|
||||||
|
from reviewers.models import ApprovalActivity
|
||||||
from stats.models import ExtensionView
|
from stats.models import ExtensionView
|
||||||
import ratings.models
|
import ratings.models
|
||||||
|
|
||||||
@ -408,10 +409,17 @@ class DraftExtensionView(
|
|||||||
# Send the extension and version to the review
|
# Send the extension and version to the review
|
||||||
if 'submit_draft' in self.request.POST:
|
if 'submit_draft' in self.request.POST:
|
||||||
extension_form.instance.status = extension_form.instance.STATUSES.AWAITING_REVIEW
|
extension_form.instance.status = extension_form.instance.STATUSES.AWAITING_REVIEW
|
||||||
# FIXME create ApprovalActivity
|
|
||||||
extension_form.save()
|
extension_form.save()
|
||||||
add_preview_formset.save()
|
add_preview_formset.save()
|
||||||
form.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)
|
return super().form_valid(form)
|
||||||
except forms.ValidationError as e:
|
except forms.ValidationError as e:
|
||||||
if 'hash' in e.error_dict:
|
if 'hash' in e.error_dict:
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import unittest
|
|
||||||
|
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
@ -48,7 +47,6 @@ class TestTasks(TestCase):
|
|||||||
new_notification_nr = Notification.objects.filter(recipient=moderator).count()
|
new_notification_nr = Notification.objects.filter(recipient=moderator).count()
|
||||||
self.assertEqual(new_notification_nr, notification_nr + 1)
|
self.assertEqual(new_notification_nr, notification_nr + 1)
|
||||||
|
|
||||||
@unittest.skip('FIXME in DraftExtensionView')
|
|
||||||
def test_new_extension_submitted(self):
|
def test_new_extension_submitted(self):
|
||||||
moderator = create_moderator()
|
moderator = create_moderator()
|
||||||
notification_nr = Notification.objects.filter(recipient=moderator).count()
|
notification_nr = Notification.objects.filter(recipient=moderator).count()
|
||||||
|
Loading…
Reference in New Issue
Block a user