aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2023-08-19 08:55:17 +0000
committerMario <mario@mariovavti.com>2023-08-27 19:59:24 +0200
commita27d75d610f286db81d5e1e29a35b960ef872a89 (patch)
treeafd5ecac8cbc352fd6da9fdd4159dbcb9469db7f
parent446e842904e04e9b8d74f4f4f2c5c238316f8615 (diff)
downloadvolse-hubzilla-a27d75d610f286db81d5e1e29a35b960ef872a89.tar.gz
volse-hubzilla-a27d75d610f286db81d5e1e29a35b960ef872a89.tar.bz2
volse-hubzilla-a27d75d610f286db81d5e1e29a35b960ef872a89.zip
fix notification text for likes in cases where obj.actor is not set
(cherry picked from commit ce4150cd06a5eb3995592b7c3898d980a58d3dd6)
-rw-r--r--include/conversation.php9
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');