aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2024-01-22 09:09:41 +0000
committerMario <mario@mariovavti.com>2024-01-22 09:09:41 +0000
commitb0664f7349c60183f0cb9597bd02b741d3c165c8 (patch)
tree4fa48e0c3b2761e0dc6d132f45a236ee838061c1
parent9cfd1c231843214351c81273622e848af4db7a45 (diff)
downloadvolse-hubzilla-b0664f7349c60183f0cb9597bd02b741d3c165c8.tar.gz
volse-hubzilla-b0664f7349c60183f0cb9597bd02b741d3c165c8.tar.bz2
volse-hubzilla-b0664f7349c60183f0cb9597bd02b741d3c165c8.zip
store the original announce actor (the one that pushed the item into our stream first) in source_xchan instead of owner_xchan. this way we will preserve the real owner for the thread and not have conflicts when dealing with deletes of comments or likes
-rw-r--r--Zotlabs/Daemon/Notifier.php3
-rw-r--r--Zotlabs/Lib/Activity.php8
-rw-r--r--Zotlabs/Lib/ThreadItem.php6
-rw-r--r--Zotlabs/Widget/Messages.php3
-rw-r--r--include/items.php2
5 files changed, 15 insertions, 7 deletions
diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php
index d1c0e4ec8..0474a4a26 100644
--- a/Zotlabs/Daemon/Notifier.php
+++ b/Zotlabs/Daemon/Notifier.php
@@ -374,7 +374,8 @@ class Notifier {
if (($relay_to_owner || $uplink) && ($cmd !== 'relay')) {
logger('notifier: followup relay', LOGGER_DEBUG);
- $sendto = (($uplink) ? $parent_item['source_xchan'] : (($parent_item['verb'] === ACTIVITY_SHARE) ? $parent_item['author_xchan'] : $parent_item['owner_xchan']));
+ // If the Parent item is an Announce the real owner is the parent author
+ $sendto = (($uplink) ? $parent_item['source_xchan'] : $parent_item['owner_xchan']);
self::$recipients = [$sendto];
self::$private = true;
$upstream = true;
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index 2bf8543b2..1f36177bd 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -3368,12 +3368,10 @@ class Activity {
}
if ($announce_init) {
- // If the fetch was initiated by an announce activity
- // do not set item fetched. This way the owner will be set to the
- // observer -> the announce actor
- unset($item['item_fetched']);
+ // Store the sender of the initial announce
+ $item['source_xchan'] = $observer_hash;
$item['verb'] = 'Announce';
- $item['parent_mid'] = $item['mid'];
+ $item['parent_mid'] = $item['thr_parent'] = $item['mid'];
$item['item_thread_top'] = 1;
}
diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php
index e7d6e33f8..77f26c386 100644
--- a/Zotlabs/Lib/ThreadItem.php
+++ b/Zotlabs/Lib/ThreadItem.php
@@ -907,6 +907,12 @@ class ThreadItem {
$this->owner_name = $this->data['owner']['xchan_name'];
$this->wall_to_wall = true;
}
+ elseif($this->is_toplevel() && $this->get_data_value('verb') === 'Announce' && isset($this->data['source'])) {
+ $this->owner_url = chanlink_hash($this->data['source']['xchan_hash']);
+ $this->owner_photo = $this->data['source']['xchan_photo_s'];
+ $this->owner_name = $this->data['source']['xchan_name'];
+ $this->wall_to_wall = true;
+ }
}
private function is_wall_to_wall() {
diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php
index cdd889121..b56fc86f9 100644
--- a/Zotlabs/Widget/Messages.php
+++ b/Zotlabs/Widget/Messages.php
@@ -147,6 +147,9 @@ class Messages {
if($item['owner_xchan'] !== $item['author_xchan']) {
$info .= t('via') . ' ' . $item['owner']['xchan_name'];
}
+ elseif($item['verb'] === 'Announce' && isset($item['source'])) {
+ $info .= t('via') . ' ' . $item['source']['xchan_name'];
+ }
$summary = $item['title'];
if (!$summary) {
diff --git a/include/items.php b/include/items.php
index 6cef3d2cd..d628fb29e 100644
--- a/include/items.php
+++ b/include/items.php
@@ -1837,7 +1837,7 @@ function item_store($arr, $allow_exec = false, $deliver = true) {
dbesc($r[0]['parent_mid']),
intval($arr['uid'])
);
- if($z && count($z))
+ if($z)
$r = $z;
}