Skip to content

Commit

Permalink
feat: decouple from mailman2 - explicitly model nonwg mailing lists (#…
Browse files Browse the repository at this point in the history
…7013)

* fix: remove synchronization with mailman2

* feat: manage non wg mailing lists explicitly

* chore: black

* fix: update tests for new nonwg view

* feat: drop unused models
  • Loading branch information
rjsparks authored Feb 5, 2024
1 parent b4cf04a commit efdaee3
Show file tree
Hide file tree
Showing 12 changed files with 687 additions and 286 deletions.
50 changes: 0 additions & 50 deletions ietf/bin/mailman_listinfo.py

This file was deleted.

13 changes: 0 additions & 13 deletions ietf/ietfauth/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
from ietf.group.models import Group, Role, RoleName
from ietf.ietfauth.htpasswd import update_htpasswd_file
from ietf.ietfauth.utils import has_role
from ietf.mailinglists.models import Subscribed
from ietf.meeting.factories import MeetingFactory
from ietf.nomcom.factories import NomComFactory
from ietf.person.factories import PersonFactory, EmailFactory, UserFactory, PersonalApiKeyFactory
Expand Down Expand Up @@ -250,18 +249,6 @@ def test_create_allowlisted_account(self):
# register and verify allowlisted email
self.register_and_verify(email)


def test_create_subscribed_account(self):
# verify creation with email in subscribed list
saved_delay = settings.LIST_ACCOUNT_DELAY
settings.LIST_ACCOUNT_DELAY = 1
email = "[email protected]"
s = Subscribed(email=email)
s.save()
time.sleep(1.1)
self.register_and_verify(email)
settings.LIST_ACCOUNT_DELAY = saved_delay

def test_create_existing_account(self):
# create account once
email = "[email protected]"
Expand Down
10 changes: 0 additions & 10 deletions ietf/ietfauth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,18 +160,8 @@ def create_account(request):
)
new_account_email = None # Indicate to the template that we failed to create the requested account
else:
# For the IETF 113 Registration period (at least) we are lowering the
# barriers for account creation to the simple email round-trip check
send_account_creation_email(request, new_account_email)

# The following is what to revert to should that lowered barrier prove problematic
# existing = Subscribed.objects.filter(email__iexact=new_account_email).first()
# ok_to_create = ( Allowlisted.objects.filter(email__iexact=new_account_email).exists()
# or existing and (existing.time + TimeDelta(seconds=settings.LIST_ACCOUNT_DELAY)) < DateTime.now() )
# if ok_to_create:
# send_account_creation_email(request, new_account_email)
# else:
# return render(request, 'registration/manual.html', { 'account_request_email': settings.ACCOUNT_REQUEST_EMAIL })
else:
form = RegistrationForm()

Expand Down
15 changes: 5 additions & 10 deletions ietf/mailinglists/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,15 @@

from django.contrib import admin

from ietf.mailinglists.models import List, Subscribed, Allowlisted
from ietf.mailinglists.models import NonWgMailingList, Allowlisted


class ListAdmin(admin.ModelAdmin):
list_display = ('id', 'name', 'description', 'advertised')
search_fields = ('name',)
admin.site.register(List, ListAdmin)


class SubscribedAdmin(admin.ModelAdmin):
list_display = ('id', 'time', 'email')
raw_id_fields = ('lists',)
search_fields = ('email',)
admin.site.register(Subscribed, SubscribedAdmin)
class NonWgMailingListAdmin(admin.ModelAdmin):
list_display = ('id', 'name', 'description')
search_fields = ('name',)
admin.site.register(NonWgMailingList, NonWgMailingListAdmin)


class AllowlistedAdmin(admin.ModelAdmin):
Expand Down
8 changes: 3 additions & 5 deletions ietf/mailinglists/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@


import factory
import random

from ietf.mailinglists.models import List
from ietf.mailinglists.models import NonWgMailingList

class ListFactory(factory.django.DjangoModelFactory):
class NonWgMailingListFactory(factory.django.DjangoModelFactory):
class Meta:
model = List
model = NonWgMailingList

name = factory.Sequence(lambda n: "list-name-%s" % n)
description = factory.Faker('sentence', nb_words=10)
advertised = factory.LazyAttribute(lambda obj: random.randint(0, 1))


130 changes: 0 additions & 130 deletions ietf/mailinglists/management/commands/import_mailman_listinfo.py

This file was deleted.

Loading

0 comments on commit efdaee3

Please sign in to comment.