[Patchew-devel] [PATCH] tags: provide quick access to the newest version of a series

Paolo Bonzini posted 1 patch 1 month, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/patchew-ci tags/patchew/20220812131940.195685-1-pbonzini@redhat.com
mods/tags.py | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
[Patchew-devel] [PATCH] tags: provide quick access to the newest version of a series
Posted by Paolo Bonzini 1 month, 2 weeks ago
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 mods/tags.py | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/mods/tags.py b/mods/tags.py
index f60abb4..3e667ec 100644
--- a/mods/tags.py
+++ b/mods/tags.py
@@ -13,8 +13,13 @@ from mbox import addr_db_to_rest, parse_address
 from event import register_handler, emit_event, declare_event
 from api.models import Message
 from api.rest import PluginMethodField
+
+from django.urls import reverse
+from django.utils.html import format_html
+
 import rest_framework
 
+
 REV_BY_PREFIX = "Reviewed-by:"
 BASED_ON_PREFIX = "Based-on:"
 SUPERSEDES_PREFIX = "Supersedes:"
@@ -189,12 +194,30 @@ series cover letter, patch mail body and their replies.
             )
 
         if message.is_obsolete:
+            latest_url = reverse(
+                "series_detail",
+                kwargs={
+                    "project": message.project.name,
+                    "message_id": message.topic.latest.message_id,
+                },
+            )
+
             message.status_tags.append(
                 {
                     "title": "Has a newer version: " + message.topic.latest.subject,
                     "type": "secondary",
                     "char": "O",
                     "row_class": "obsolete",
+                    "url": latest_url,
+                }
+            )
+            message.extra_status.append(
+                {
+                    "icon": "fa-redo-alt",  # aka rotate-right in newer versions
+                    "html": format_html(
+                        'There is a <a href="{}">newer version</a> of this series',
+                        latest_url,
+                    ),
                 }
             )
 
-- 
2.37.1

_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/patchew-devel