From a27d75d610f286db81d5e1e29a35b960ef872a89 Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 19 Aug 2023 08:55:17 +0000 Subject: fix notification text for likes in cases where obj.actor is not set (cherry picked from commit ce4150cd06a5eb3995592b7c3898d980a58d3dd6) --- include/conversation.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include/conversation.php') diff --git a/include/conversation.php b/include/conversation.php index c02b0c4c8..5e63c4199 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -108,6 +108,8 @@ function localize_item(&$item){ $author_link = ((is_array($obj['actor']['url'])) ? $obj['actor']['url'][0]['href'] : $obj['actor']['url']); elseif (isset($obj['actor']) && is_string($obj['actor'])) $author_link = $obj['actor']; + elseif (isset($obj['attributedTo']) && is_string($obj['attributedTo']) && $obj['attributedTo']) + $author_link = $obj['attributedTo']; else $author_link = ''; @@ -123,6 +125,13 @@ function localize_item(&$item){ } } + if(!$author_name && isset($obj['attributedTo']) && is_string($obj['attributedTo'])) { + $cached_actor = Activity::get_cached_actor($obj['attributedTo']); + if (is_array($cached_actor)) { + $author_name = $cached_actor['name'] ?? $cached_actor['preferredUsername']; + } + } + $item_url = ''; if(isset($obj['link']) && is_array($obj['link'])) $item_url = get_rel_link($obj['link'],'alternate'); -- cgit v1.2.3