This is an automated email from the ASF dual-hosted git repository.

gcruz pushed a commit to branch gc/8481
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 5be2ff7a08bc86259f46167d8a598601f7d38a3c
Author: Guillermo Cruz <[email protected]>
AuthorDate: Wed Nov 23 14:53:43 2022 -0600

    [#8481] added two new attributes to provide more context in activity stream
---
 ForgeActivity/forgeactivity/main.py                 | 3 +++
 ForgeActivity/forgeactivity/templates/macros.html   | 3 +++
 ForgeActivity/forgeactivity/templates/timeline.html | 5 +++++
 3 files changed, 11 insertions(+)

diff --git a/ForgeActivity/forgeactivity/main.py 
b/ForgeActivity/forgeactivity/main.py
index 30a2bdd41..5bf0765a5 100644
--- a/ForgeActivity/forgeactivity/main.py
+++ b/ForgeActivity/forgeactivity/main.py
@@ -157,6 +157,9 @@ class ForgeActivityController(BaseController):
             should_noindex = any(name in noindex_tags for name in t.tags)
             t.obj.noindex = should_noindex
             t.target.noindex = should_noindex
+            if t.obj.activity_url and t.obj.activity_url.startswith('/p'):
+                t.obj.project_name = t.obj.activity_url.split('/')[2]
+                t.obj.mount_label = t.obj.activity_url.split('/')[3]
             session(t).expunge(t)  # don't save back these changes
         if extra_limit == limit:
             # if we didn't ask for extra, then we expect there's more if we 
got all we asked for
diff --git a/ForgeActivity/forgeactivity/templates/macros.html 
b/ForgeActivity/forgeactivity/templates/macros.html
index 8b08adbf0..f7afbf26c 100644
--- a/ForgeActivity/forgeactivity/templates/macros.html
+++ b/ForgeActivity/forgeactivity/templates/macros.html
@@ -53,6 +53,9 @@
                         {% if a.target.activity_name %}on {{ 
activity_obj(a.target) }}{% endif %}
                         {% if a.obj.project %}on
                             <a href="{{ a.obj.project.url() }}">{{ 
a.obj.project.name }}</a>{% endif %}
+                        {%  if a.obj.project_name and a.obj.mount_label %}
+                            in {{ a.obj.project_name }} / {{ a.obj.mount_label 
}}
+                        {% endif %}
                     </b>
                     {% if a.obj.activity_extras.get('summary') %}
                         <p>
diff --git a/ForgeActivity/forgeactivity/templates/timeline.html 
b/ForgeActivity/forgeactivity/templates/timeline.html
index 37bf126db..a5dc20386 100644
--- a/ForgeActivity/forgeactivity/templates/timeline.html
+++ b/ForgeActivity/forgeactivity/templates/timeline.html
@@ -24,11 +24,16 @@
   <h1>
       {{ am.icon(a.actor, 32, 'avatar') }}
       {{am.activity_obj(a.actor)}} {{a.verb}} {{am.activity_obj(a.obj)}} {% if 
a.target.activity_name %}on {{am.activity_obj(a.target)}}{% endif %}
+
+      {%  if a.obj.project_name and a.obj.mount_label %}
+        in {{ a.obj.project_name }}/{{ a.obj.mount_label }}
+      {% endif %}
   </h1>
   {% if a.obj.activity_extras.get('summary') %}
   <p>
     {{ a.obj.activity_extras.get('summary') }}
   </p>
   {% endif %}
+
 </li>
 {% endfor %}

Reply via email to