diff options
author | Mario <mario@mariovavti.com> | 2023-08-19 08:55:17 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2023-08-19 08:55:17 +0000 |
commit | ce4150cd06a5eb3995592b7c3898d980a58d3dd6 (patch) | |
tree | 16902bd90b1eaafc22c0b62a3c8502b1e2037cb1 /include/conversation.php | |
parent | be19b7503105955b58c85dbec65c02626c9e5000 (diff) | |
download | volse-hubzilla-ce4150cd06a5eb3995592b7c3898d980a58d3dd6.tar.gz volse-hubzilla-ce4150cd06a5eb3995592b7c3898d980a58d3dd6.tar.bz2 volse-hubzilla-ce4150cd06a5eb3995592b7c3898d980a58d3dd6.zip |
fix notification text for likes in cases where obj.actor is not set
Diffstat (limited to 'include/conversation.php')
-rw-r--r-- | include/conversation.php | 9 |
1 files changed, 9 insertions, 0 deletions
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'); |