Commit a769580f authored by Florian Fuchs's avatar Florian Fuchs

Merge branch 'fix-archive-link' into 'master'

Only display link to hyperkitty if archive is accessible to the user

Fixes #20 

See merge request !151
parents 30e2b86c baa1962f
Pipeline #4320206 passed with stage
in 2 minutes and 46 seconds
......@@ -18,12 +18,20 @@
<p>{% trans 'To contact the list owners, use the following email address:' %} <em>{{ list.settings.owner_address }}</em></p>
{# Archives #}
{% if 'hyperkitty' in INSTALLED_APPS %}
{% if hyperkitty_enabled %}
{% if not public_archive and not user.is_authenticated %}
<p>
{% trans 'You have to login to visit the archives of this list.' %}
</p>
{% else %}
{% url 'hk_list_overview' list.fqdn_listname as hyperkitty_list_url %}
{% blocktrans %}
<p>To see the prior postings to this list, visit
<a href="{{ hyperkitty_list_url }}">the archives</a>.</p>
{% endblocktrans %}
<p>
{% blocktrans %}
To see the prior postings to this list, visit
<a href="{{ hyperkitty_list_url }}">the archives</a>.
{% endblocktrans %}
</p>
{% endif %}
{% endif %}
<hr />
......
......@@ -24,6 +24,7 @@ import logging
from allauth.account.models import EmailAddress
from django.http import HttpResponse, HttpResponseNotAllowed, Http404
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
......@@ -201,7 +202,15 @@ class ListSummaryView(MailingListView):
def get(self, request, list_id):
data = {'list': self.mailing_list,
'userSubscribed': False,
'subscribed_address': None}
'subscribed_address': None,
'public_archive': False,
'hyperkitty_enabled': False}
if self.mailing_list.settings['archive_policy'] == 'public':
data['public_archive'] = True
if ('hyperkitty' in settings.INSTALLED_APPS and
'hyperkitty' in self.mailing_list.archivers and
self.mailing_list.archivers['hyperkitty']):
data['hyperkitty_enabled'] = True
if request.user.is_authenticated():
user_emails = EmailAddress.objects.filter(
user=request.user, verified=True).order_by(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment