fix: better archive search links for group documents (#6835)

This commit is contained in:
Robert Sparks 2024-01-09 15:17:11 -06:00 committed by GitHub
parent e24fb601db
commit 3312913c6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 1 deletions

View file

@ -0,0 +1,24 @@
# Copyright The IETF Trust 2023, All Rights Reserved
from django.conf import settings
from django.db import migrations
from django.db.models import Value
from django.db.models.functions import Replace
def forward(apps, schema_editor):
Group = apps.get_model("group", "Group")
old_pattern = f"{settings.MAILING_LIST_ARCHIVE_URL}/arch/search/?email_list="
new_pattern = f"{settings.MAILING_LIST_ARCHIVE_URL}/arch/browse/"
Group.objects.filter(list_archive__startswith=old_pattern).update(
list_archive=Replace("list_archive", Value(old_pattern), Value(new_pattern))
)
class Migration(migrations.Migration):
dependencies = [
("group", "0003_iabworkshops"),
]
operations = [migrations.RunPython(forward)]

View file

@ -431,7 +431,7 @@
{% endfor %} {% endfor %}
{% if doc.group and doc.group.list_archive %} {% if doc.group and doc.group.list_archive %}
{% if doc.group.list_archive|startswith:settings.MAILING_LIST_ARCHIVE_URL %} {% if doc.group.list_archive|startswith:settings.MAILING_LIST_ARCHIVE_URL %}
<a href="{{ doc.group.list_archive }}?q={{ doc.name }}"> <a href="{{ doc.group.list_archive }}?q={{ doc.name }}{% if doc.came_from_draft %} OR %22{{ doc.came_from_draft.name }}%22{% endif%}">
Mailing list discussion Mailing list discussion
</a> </a>
{% elif doc.group.list_archive|is_valid_url %} {% elif doc.group.list_archive|is_valid_url %}