Commit fbb2344af6c5c73c7e089ab507d1936674111507
1 parent
cdd61ed3
Exists in
master
and in
39 other branches
Using API to subscribe user to mailinglists
Showing
2 changed files
with
3 additions
and
20 deletions
Show diff stats
src/accounts/views.py
... | ... | @@ -23,7 +23,6 @@ from conversejs.models import XMPPAccount |
23 | 23 | from haystack.query import SearchQuerySet |
24 | 24 | |
25 | 25 | from super_archives.models import EmailAddress, Message |
26 | -from super_archives.utils.email import send_email_lists | |
27 | 26 | from search.utils import trans |
28 | 27 | #from proxy.trac.models import WikiCollabCount, TicketCollabCount |
29 | 28 | from .forms import (UserCreationForm, ListsForm, UserUpdateForm, |
... | ... | @@ -141,10 +140,6 @@ def signup(request): |
141 | 140 | |
142 | 141 | user = user_form.save() |
143 | 142 | |
144 | - mailing_lists = lists_form.cleaned_data.get('lists') | |
145 | - if mailing_lists: | |
146 | - send_email_lists(user, mailing_lists) | |
147 | - | |
148 | 143 | # Check if the user's email have been used previously |
149 | 144 | # in the mainling lists to link the user to old messages |
150 | 145 | email_addr, created = EmailAddress.objects.get_or_create(address=user.email) |
... | ... | @@ -154,6 +149,9 @@ def signup(request): |
154 | 149 | email_addr.user = user |
155 | 150 | email_addr.save() |
156 | 151 | |
152 | + mailing_lists = lists_form.cleaned_data.get('lists') | |
153 | + mailman.update_subscription(user.email, mailing_lists) | |
154 | + | |
157 | 155 | messages.success(request, _('Your profile has been created!')) |
158 | 156 | messages.warning(request, _('You must login to validated your profile. ' |
159 | 157 | 'Profiles not validated are deleted in 24h.')) | ... | ... |
src/super_archives/utils/email.py
... | ... | @@ -17,18 +17,3 @@ def send_verification_email(to, user, validation_key): |
17 | 17 | 'key': validation_key, |
18 | 18 | 'SITE_URL': settings.SITE_URL})) |
19 | 19 | return colab_send_email(subject, message, to) |
20 | - | |
21 | - | |
22 | -def send_email_lists(user, mailing_lists): | |
23 | - """XXX: this should be done using API instead of emails""" | |
24 | - | |
25 | - subject = _(u'Registration on the mailing list') | |
26 | - from_ = user.email | |
27 | - to = [] | |
28 | - for list_name in mailing_lists: | |
29 | - # TODO: The following line needs to be generic. Domain should be stored in settings file | |
30 | - # or database (perharps read directly from mailman). | |
31 | - subscribe_addr = list_name + '-subscribe@listas.interlegis.gov.br' | |
32 | - to.append(subscribe_addr) | |
33 | - | |
34 | - mail.send_mail(subject, '', from_, to) | ... | ... |