diff --git a/src/postorius/templates/postorius/lists/summary.html b/src/postorius/templates/postorius/lists/summary.html index f964d0f..699a934 100644 --- a/src/postorius/templates/postorius/lists/summary.html +++ b/src/postorius/templates/postorius/lists/summary.html @@ -38,7 +38,7 @@ {# Subscription #} {% if user.is_authenticated %} - {% if userSubscribed %} + {% if user_subscribed %}

{% trans 'Subscription' %}

{% trans 'You are subscribed to this list with the following address:' %} {{ subscribed_address }} @@ -56,6 +56,8 @@

+ {% elif user_request_pending %} +

{% trans "You have a subscription request pending. If you don't hear back soon, please contact the list owners." %}

{% else %}

{% trans 'Subscribe to this list' %}

diff --git a/src/postorius/views/list.py b/src/postorius/views/list.py index 5dad81a..b47eac1 100644 --- a/src/postorius/views/list.py +++ b/src/postorius/views/list.py @@ -201,7 +201,7 @@ def get(self, request, list_id): data = {'list': self.mailing_list, - 'userSubscribed': False, + 'user_subscribed': False, 'subscribed_address': None, 'public_archive': False, 'hyperkitty_enabled': False} @@ -220,13 +220,17 @@ user_emails = EmailAddress.objects.filter( user=request.user, verified=True).order_by( "email").values_list("email", flat=True) + pending_requests = [r['email'] for r in self.mailing_list.requests] for address in user_emails: + if address in pending_requests: + data['user_request_pending'] = True + break try: self.mailing_list.get_member(address) except ValueError: pass else: - data['userSubscribed'] = True + data['user_subscribed'] = True data['subscribed_address'] = address break # no need to test more addresses data['subscribe_form'] = ListSubscribe(user_emails)