diff --git a/src/postorius/templates/postorius/lists/summary.html b/src/postorius/templates/postorius/lists/summary.html index bd03223..a95c3d2 100644 --- a/src/postorius/templates/postorius/lists/summary.html +++ b/src/postorius/templates/postorius/lists/summary.html @@ -26,26 +26,23 @@
{# Subscription #} -

{% trans 'Subscription' %}

{% if user.is_authenticated %} {% if userSubscribed %} +

{% trans 'Subscription' %}

{% trans 'You are subscribed to this list with the following address:' %} {{ subscribed_address }}

-
- {% render_form_horizontal change_subscription_form 2 8 'Change subscription' %} -
-

- - {% trans 'Unsubscribe' %} {{ subscribed_address }} - -

{% url 'user_list_options' list.list_id as user_list_options_url %} {% blocktrans %}

You can manage your subscription here

{% endblocktrans %} +

+ + {% trans 'Unsubscribe' %} {{ subscribed_address }} + +

{% else %}

{% trans 'Subscribe to this list' %}

@@ -53,7 +50,7 @@
{% endif %} {% else %} -

{% trans 'You have to log in to subscribe to this list.' %}

+

{% trans 'If you want to subscribe to this list, you have to log in first.' %}

{% trans 'Log In' %}

{% endif %} diff --git a/src/postorius/templates/postorius/user/list_options.html b/src/postorius/templates/postorius/user/list_options.html index 6666c23..a766b8a 100644 --- a/src/postorius/templates/postorius/user/list_options.html +++ b/src/postorius/templates/postorius/user/list_options.html @@ -10,6 +10,13 @@ {% block main %}

{% trans 'Subscription options for' %} {{ list.fqdn_listname }}


+

+{% trans 'Use this form to change the email used for this subscription' %}: +

+
+ {% render_form_horizontal change_subscription_form 3 8 'Change email used for subscription' %} +
+
{% render_form_horizontal form 3 8 'Save changes' %} diff --git a/src/postorius/tests/mailman_api_tests/test_list_summary.py b/src/postorius/tests/mailman_api_tests/test_list_summary.py index 0472659..1d25ad6 100644 --- a/src/postorius/tests/mailman_api_tests/test_list_summary.py +++ b/src/postorius/tests/mailman_api_tests/test_list_summary.py @@ -103,7 +103,7 @@ response = self.client.get(reverse('list_summary', args=('foo@example.com', ))) self.assertEqual(response.status_code, 200) - self.assertTrue('Change subscription' in response.content) + self.assertTrue('Change email used for subscription' in response.content) self.assertTrue('Unsubscribe' in response.content) @MM_VCR.use_cassette('test_list_summary_owner.yaml') diff --git a/src/postorius/views/list.py b/src/postorius/views/list.py index 3d90b69..d210b85 100644 --- a/src/postorius/views/list.py +++ b/src/postorius/views/list.py @@ -180,12 +180,9 @@ data['userSubscribed'] = True data['subscribed_address'] = address break # no need to test more addresses - data['change_subscription_form'] = ChangeSubscriptionForm( - user_emails, initial={'email': data['subscribed_address']}) data['subscribe_form'] = ListSubscribe(user_emails) else: user_emails = None - data['change_subscription_form'] = None return render_to_response( 'postorius/lists/summary.html', data, context_instance=RequestContext(request)) diff --git a/src/postorius/views/user.py b/src/postorius/views/user.py index e64c1e8..8eefd63 100644 --- a/src/postorius/views/user.py +++ b/src/postorius/views/user.py @@ -129,6 +129,7 @@ @login_required def user_list_options(request, list_id): + utils.set_other_emails(request.user) mlist = List.objects.get_or_404(fqdn_listname=list_id) mm_user = MailmanUser.objects.get(address=request.user.email) subscription = None @@ -150,9 +151,11 @@ messages.error(request, _('Something went wrong.')) else: form = UserPreferences(initial=subscription.preferences) + user_emails = [request.user.email] + request.user.other_emails + subscription_form = ChangeSubscriptionForm(user_emails, initial={'email': subscription.email}) return render_to_response('postorius/user/list_options.html', - {'form': form, 'list': mlist,}, context_instance=RequestContext(request)) - + {'form': form, 'list': mlist, 'change_subscription_form': subscription_form}, context_instance=RequestContext(request)) + class UserSubscriptionPreferencesView(MailmanUserView): """The logged-in user's subscription-based Mailman Preferences."""