aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2024-02-15 14:27:50 +0000
committerMario <mario@mariovavti.com>2024-02-15 14:27:50 +0000
commit6d125d02d8cc6b09843919eb9413abbb85582c1e (patch)
tree05d53765a6c4856dc9a989385678bedaceeb044c
parent0b18b35f5f28b0afc3104f10d33fac5b1675a76a (diff)
downloadvolse-hubzilla-6d125d02d8cc6b09843919eb9413abbb85582c1e.tar.gz
volse-hubzilla-6d125d02d8cc6b09843919eb9413abbb85582c1e.tar.bz2
volse-hubzilla-6d125d02d8cc6b09843919eb9413abbb85582c1e.zip
introduce get_actor() force flag to omit cache, rework contact refresh, special handling for announce by group, and revert change regarding friendica addressing anomality
-rw-r--r--Zotlabs/Lib/Activity.php32
-rw-r--r--Zotlabs/Module/Contactedit.php32
-rw-r--r--view/tpl/contact_edit_tools.tpl1
3 files changed, 38 insertions, 27 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index 0f76fce9a..ab96423d7 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -1659,7 +1659,7 @@ class Activity {
if ($ap_hubloc) {
// we already have a stored record. Determine if it needs updating.
if ($ap_hubloc['hubloc_updated'] < datetime_convert('UTC', 'UTC', ' now - 3 days') || $force) {
- $person_obj = self::get_cached_actor($url);
+ $person_obj = self::get_actor($url, $force);
}
else {
return;
@@ -2370,6 +2370,7 @@ class Activity {
}
if (!$response_activity) {
+/*
if ($act->type === 'Announce') {
$s['author_xchan'] = self::get_attributed_to_actor_url($act);
$s['mid'] = $act->objprop('id') ?: $act->obj;
@@ -2379,6 +2380,7 @@ class Activity {
$s['parent_mid'] = $act->objprop('id') ?: $act->obj;
}
}
+*/
// we will need a hook here to extract magnet links e.g. peertube
// right now just link to the largest mp4 we find that will fit in our
@@ -2713,12 +2715,12 @@ class Activity {
}
// An ugly and imperfect way to recognise a mastodon or friendica direct message
- if (empty($act->recips) || // friendica
- ($item['item_private'] === 1 &&
+ if (
+ $item['item_private'] === 1 &&
!isset($act->raw_recips['cc']) &&
is_array($act->raw_recips['to']) &&
in_array(channel_url($channel), $act->raw_recips['to']) &&
- !in_array($act->actor['followers'], $act->raw_recips['to']))
+ !in_array($act->actor['followers'], $act->raw_recips['to'])
) {
$item['item_private'] = 2;
}
@@ -3076,10 +3078,12 @@ class Activity {
$p = [];
$announce_init = false;
+ $group_announce_init = false;
if (is_object($act) && is_array($item)) {
$p[] = [$act, $item];
$announce_init = ($item['verb'] === 'Announce');
+ $group_announce_init = ($announce_init && $act->actor['type'] === 'Group');
}
if (is_string($item)) {
@@ -3149,12 +3153,22 @@ class Activity {
$item['source_xchan'] = $observer_hash;
// WARNING: the presence of both source_xchan and non-zero item_uplink here will cause a delivery loop
$item['item_uplink'] = 0;
- $item['verb'] = 'Announce';
- $item['parent_mid'] = $item['thr_parent'] = $item['mid'];
- $item['item_thread_top'] = 1;
+
+ if ($item['item_thread_top']) {
+ $item['verb'] = 'Announce';
+ }
+
+ if (!$group_announce_init) {
+ // Force a new thread if the announce init actor is not a group
+ $item['verb'] = 'Announce';
+ $item['parent_mid'] = $item['thr_parent'] = $item['mid'];
+ $item['item_thread_top'] = 1;
+ }
+
}
else {
$announce_init = ($i === 0 && $item['verb'] === 'Announce');
+ $group_announce_init = ($announce_init && $a->actor['type'] === 'Group');
}
if (intval($channel['channel_system']) && intval($item['item_private'])) {
@@ -3483,11 +3497,11 @@ class Activity {
return $hookdata['actor'];
}
- static function get_actor($actor_id) {
+ static function get_actor($actor_id, $force = false) {
// remove fragment
$actor_id = ((strpos($actor_id, '#')) ? substr($actor_id, 0, strpos($actor_id, '#')) : $actor_id);
- $actor = self::get_cached_actor($actor_id);
+ $actor = ((!$force) ? self::get_cached_actor($actor_id) : null);
if ($actor) {
return $actor;
diff --git a/Zotlabs/Module/Contactedit.php b/Zotlabs/Module/Contactedit.php
index 58c3380a1..e20e90872 100644
--- a/Zotlabs/Module/Contactedit.php
+++ b/Zotlabs/Module/Contactedit.php
@@ -494,28 +494,32 @@ class Contactedit extends Controller {
'message' => ''
];
- if ($cmd === 'resetphoto') {
- q("update xchan set xchan_photo_date = '2001-01-01 00:00:00' where xchan_hash = '%s'",
+ if ($cmd === 'refresh') {
+ q("update xchan set xchan_photo_date = '0001-01-01 00:00:00', xchan_name_date = '0001-01-01 00:00:00' where xchan_hash = '%s'",
dbesc($contact['xchan_hash'])
);
- $cmd = 'refresh';
- }
- if ($cmd === 'refresh') {
if ($contact['xchan_network'] === 'zot6') {
if (Libzot::refresh($contact, App::get_channel())) {
$ret['success'] = true;
$ret['message'] = t('Refresh succeeded');
}
else {
- $ret['message'] = t('Refresh failed - channel is currently unavailable');
+ $ret['message'] = t('Refresh failed');
}
}
else {
// if you are on a different network we'll force a refresh of the connection basic info
- Master::Summon(['Notifier', 'permission_update', $contact['abook_id']]);
- $ret['success'] = true;
- $ret['message'] = t('Refresh succeeded');
+ $hookinfo = [
+ 'contact' => $contact,
+ 'success' => false,
+ 'message' => ''
+ ];
+
+ call_hooks('actor_refetch', $hookinfo);
+
+ $ret['success'] = $hookinfo['success'];
+ $ret['message'] = $hookinfo['message'];
}
return $ret;
@@ -625,16 +629,10 @@ class Contactedit extends Controller {
return [
'refresh' => [
- 'label' => t('Refresh Permissions'),
- 'title' => t('Fetch updated permissions'),
+ 'label' => t('Refresh'),
+ 'title' => t('Refetch contact info'),
],
- 'rephoto' => [
- 'label' => t('Refresh Photo'),
- 'title' => t('Fetch updated photo'),
- ],
-
-
'block' => [
'label' => (intval($contact['abook_blocked']) ? t('Unblock') : t('Block')),
'sel' => (intval($contact['abook_blocked']) ? 'active' : ''),
diff --git a/view/tpl/contact_edit_tools.tpl b/view/tpl/contact_edit_tools.tpl
index 565b9df86..2d0b8a8cf 100644
--- a/view/tpl/contact_edit_tools.tpl
+++ b/view/tpl/contact_edit_tools.tpl
@@ -3,7 +3,6 @@
</button>
<div class="dropdown-menu">
<a class="dropdown-item contact-tool" href="#" title="{{$tools.refresh.title}}" data-cmd="refresh">{{$tools.refresh.label}}</a>
- <a class="dropdown-item contact-tool" href="#" title="{{$tools.rephoto.title}}" data-cmd="resetphoto">{{$tools.rephoto.label}}</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item contact-tool" href="#" title="{{$tools.block.title}}" data-cmd="block">{{$tools.block.label}}</a>
<a class="dropdown-item contact-tool" href="#" title="{{$tools.ignore.title}}" data-cmd="ignore">{{$tools.ignore.label}}</a>