Skip to content

Commit

Permalink
fix: better archive search links for group documents (#6835)
Browse files Browse the repository at this point in the history
  • Loading branch information
rjsparks committed Jan 9, 2024
1 parent e24fb60 commit 3312913
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
24 changes: 24 additions & 0 deletions ietf/group/migrations/0004_modern_list_archive.py
@@ -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)]
2 changes: 1 addition & 1 deletion ietf/templates/doc/document_info.html
Expand Up @@ -431,7 +431,7 @@
{% endfor %}
{% if doc.group and doc.group.list_archive %}
{% 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
</a>
{% elif doc.group.list_archive|is_valid_url %}
Expand Down

0 comments on commit 3312913

Please sign in to comment.