Repository: WeblateOrg/weblate

Issue:
History has uncategorized links
### Describe the issue

Links in the history do not show what category the component is in.

### I already tried

- [X] I've read and searched [the documentation](https://docs.weblate.org/).
- [X] I've searched for similar issues in this repository.

### Steps to reproduce the behavior

1 Go to Insights->History
2 I see the old link format

### Expected behavior

_No response_

### Screenshots

![image](https://github.com/WeblateOrg/weblate/assets/39633242/22ffa77f-89df-4346-8286-0246e3210a9f)
---------------------------------------------------------------------------------------------------------------------------
![image](https://github.com/WeblateOrg/weblate/assets/39633242/6376c018-d605-4eb7-8e52-99a22e25d676)


### Exception traceback

_No response_

### How do you run Weblate?

Docker container

### Weblate versions

_No response_

### Weblate deploy checks

_No response_

### Additional context

_No response_


Discussion:

Resolving patch:
diff --git a/weblate/trans/models/change.py b/weblate/trans/models/change.py
--- a/weblate/trans/models/change.py
+++ b/weblate/trans/models/change.py
@@ -615,6 +615,17 @@ def get_absolute_url(self):
             return self.project.get_absolute_url()
         return None
 
+    @property
+    def path_object(self):
+        """Return link either to unit or translation."""
+        if self.translation is not None:
+            return self.translation
+        if self.component is not None:
+            return self.component
+        if self.project is not None:
+            return self.project
+        return None
+
     def __init__(self, *args, **kwargs):
         self.notify_state = {}
         for attr in ("user", "author"):
diff --git a/weblate/trans/templatetags/translations.py b/weblate/trans/templatetags/translations.py
--- a/weblate/trans/templatetags/translations.py
+++ b/weblate/trans/templatetags/translations.py
@@ -1191,7 +1191,7 @@ def urlize_ugc(value, autoescape=True):
     )
 
 
-def get_breadcrumbs(path_object):
+def get_breadcrumbs(path_object, flags: bool = True):
     if isinstance(path_object, Unit):
         yield from get_breadcrumbs(path_object.translation)
         yield path_object.get_absolute_url(), path_object.pk
@@ -1203,13 +1203,16 @@ def get_breadcrumbs(path_object):
             yield from get_breadcrumbs(path_object.category)
         else:
             yield from get_breadcrumbs(path_object.project)
-        yield path_object.get_absolute_url(), format_html(
-            "{}{}",
-            path_object.name,
-            render_to_string(
-                "snippets/component-glossary-badge.html", {"object": path_object}
-            ),
-        )
+        name = path_object.name
+        if flags:
+            name = format_html(
+                "{}{}",
+                name,
+                render_to_string(
+                    "snippets/component-glossary-badge.html", {"object": path_object}
+                ),
+            )
+        yield path_object.get_absolute_url(), name
     elif isinstance(path_object, Category):
         if path_object.category:
             yield from get_breadcrumbs(path_object.category)
@@ -1236,9 +1239,9 @@ def get_breadcrumbs(path_object):
 
 
 @register.simple_tag
-def path_object_breadcrumbs(path_object):
+def path_object_breadcrumbs(path_object, flags: bool = True):
     return format_html_join(
-        "\n", '<li><a href="{}">{}</a></li>', get_breadcrumbs(path_object)
+        "\n", '<li><a href="{}">{}</a></li>', get_breadcrumbs(path_object, flags)
     )
 
 


Test patch: