aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2022-08-04 12:13:00 +0200
committerMario Vavti <mario@mariovavti.com>2022-08-04 12:13:00 +0200
commit0679cb8e00daee2f3d863b5ec2ccb22163f2b955 (patch)
tree9e820a7b34d5d5e197329fdc066382739f2dcc56
parent2e9211cf413973a116eff864ad04336ebe14ad3a (diff)
downloadvolse-hubzilla-0679cb8e00daee2f3d863b5ec2ccb22163f2b955.tar.gz
volse-hubzilla-0679cb8e00daee2f3d863b5ec2ccb22163f2b955.tar.bz2
volse-hubzilla-0679cb8e00daee2f3d863b5ec2ccb22163f2b955.zip
fix wrong attribution in unseen like notifications
-rw-r--r--include/conversation.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/include/conversation.php b/include/conversation.php
index d509342d4..685e6b15b 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -1,6 +1,7 @@
<?php /** @file */
use Zotlabs\Lib\Apps;
+use Zotlabs\Lib\Activity;
require_once('include/items.php');
@@ -90,7 +91,6 @@ function item_redir_and_replace_images($body, $images, $cid) {
function localize_item(&$item){
if (activity_match($item['verb'],ACTIVITY_LIKE) || activity_match($item['verb'],ACTIVITY_DISLIKE)){
-
if(! $item['obj'])
return;
@@ -106,6 +106,8 @@ function localize_item(&$item){
$author_link = get_rel_link($obj['author']['link'],'alternate');
elseif(is_array($obj['actor']) && $obj['actor']['url'])
$author_link = ((is_array($obj['actor']['url'])) ? $obj['actor']['url'][0]['href'] : $obj['actor']['url']);
+ elseif (is_string($obj['actor']))
+ $author_link = $obj['actor'];
else
$author_link = '';
@@ -114,6 +116,13 @@ function localize_item(&$item){
if(!$author_name)
$author_name = ((is_array($obj['actor']) && $obj['actor']['name']) ? $obj['actor']['name'] : '');
+ if(!$author_name && is_string($obj['actor'])) {
+ $cached_actor = Activity::get_cached_actor($obj['actor']);
+ if (is_array($cached_actor)) {
+ $author_name = (($cached_actor['name']) ? $cached_actor['name'] : $cached_actor['preferredUsername']);
+ }
+ }
+
if(is_array($obj['link']))
$item_url = get_rel_link($obj['link'],'alternate');