You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2021/10/07 15:45:39 UTC

[allura] branch master updated: fixing icon cache issues by updating the activitystream icon_url with the value from default_avatar_image

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

brondsem pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git


The following commit(s) were added to refs/heads/master by this push:
     new 9c490a0  fixing icon cache issues by updating the activitystream icon_url with the value from default_avatar_image
9c490a0 is described below

commit 9c490a051ca912d28b81ce656441d6fed100cb24
Author: Guillermo Cruz <gu...@slashdotmedia.com>
AuthorDate: Mon Oct 4 17:53:55 2021 +0000

    fixing icon cache issues by updating the activitystream icon_url with the value from default_avatar_image
---
 ForgeActivity/forgeactivity/main.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/ForgeActivity/forgeactivity/main.py b/ForgeActivity/forgeactivity/main.py
index 2fafebd..e73ecfa 100644
--- a/ForgeActivity/forgeactivity/main.py
+++ b/ForgeActivity/forgeactivity/main.py
@@ -47,7 +47,7 @@ from allura.ext.user_profile import ProfileSectionBase
 
 from .widgets.follow import FollowToggle
 from six.moves import filter
-
+import re
 log = logging.getLogger(__name__)
 
 
@@ -124,8 +124,15 @@ class ForgeActivityController(BaseController):
         timeline = g.director.get_timeline(followee, page,
                                            limit=extra_limit,
                                            actor_only=actor_only)
+
         filtered_timeline = list(islice(filter(perm_check(c.user), timeline),
                                         0, limit))
+        for t in filtered_timeline:
+            if hasattr(t.actor.activity_extras, 'icon_url') and config.get("default_avatar_image"):
+                t.actor.activity_extras.icon_url = re.sub(r'([&?])d=[^&]*', r'\1d={}'.format(config["default_avatar_image"]),
+                                                          t.actor.activity_extras.icon_url)
+                session(t).expunge(t)  # don't save back this change
+
         if extra_limit == limit:
             # if we didn't ask for extra, then we expect there's more if we got all we asked for
             has_more = len(timeline) == limit