improved fetch_conversation()

This commit is contained in:
Mario Vavti
2023-04-23 13:02:38 +02:00
parent 80d70e64f5
commit 81f33da499
2 changed files with 19 additions and 18 deletions

View File

@@ -3991,18 +3991,18 @@ class Activity {
switch ($options) {
case 'activitypub':
$hublocs = q("select * from hubloc left join xchan on hubloc_hash = xchan_hash where hubloc_hash = '%s' and hubloc_deleted = 0 ",
$hublocs = q("select * from hubloc left join xchan on hubloc_hash = xchan_hash where hubloc_hash = '%s' and hubloc_deleted = 0 order by hubloc_id desc",
dbesc($url)
);
break;
case 'zot6':
$hublocs = q("select * from hubloc left join xchan on hubloc_hash = xchan_hash where hubloc_id_url = '%s' and hubloc_deleted = 0 ",
$hublocs = q("select * from hubloc left join xchan on hubloc_hash = xchan_hash where hubloc_id_url = '%s' and hubloc_deleted = 0 order by hubloc_id desc",
dbesc($url)
);
break;
case 'all':
default:
$hublocs = q("select * from hubloc left join xchan on hubloc_hash = xchan_hash where ( hubloc_id_url = '%s' OR hubloc_hash = '%s' ) and hubloc_deleted = 0 ",
$hublocs = q("select * from hubloc left join xchan on hubloc_hash = xchan_hash where ( hubloc_id_url = '%s' OR hubloc_hash = '%s' ) and hubloc_deleted = 0 order by hubloc_id desc",
dbesc($url),
dbesc($url)
);

View File

@@ -2013,18 +2013,12 @@ class Libzot {
continue;
}
$r = q("select hubloc_hash, hubloc_network from hubloc where hubloc_id_url = '%s' order by hubloc_id desc",
dbesc($AS->actor['id'])
);
$r = Activity::get_actor_hublocs($AS->actor['id']);
$r = self::zot_record_preferred($r);
if (!$r) {
$y = import_author_xchan(['url' => $AS->actor['id']]);
if ($y) {
$r = q("select hubloc_hash, hubloc_network from hubloc where hubloc_id_url = '%s'",
dbesc($AS->actor['id'])
);
$r = Activity::get_actor_hublocs($AS->actor['id']);
$r = self::zot_record_preferred($r);
}
if (!$r) {
@@ -2034,22 +2028,29 @@ class Libzot {
}
if (isset($AS->obj['actor']['id']) && $AS->obj['actor']['id'] !== $AS->actor['id']) {
$y = import_author_xchan(['url' => $AS->obj['actor']['id']]);
if (!$y) {
logger('FOF Activity: no object actor');
continue;
$ro = Activity::get_actor_hublocs($AS->obj['actor']['id']);
$ro = self::zot_record_preferred($ro);
if (!$ro) {
$y = import_author_xchan(['url' => $AS->obj['actor']['id']]);
if ($y) {
$ro = Activity::get_actor_hublocs($AS->obj['actor']['id']);
$ro = self::zot_record_preferred($ro);
}
if (!$ro) {
logger('FOF Activity: no obj actor');
continue;
}
}
}
$arr = Activity::decode_note($AS);
if (!$arr) {
logger('FOF Activity: could not decode');
continue;
}
if ($r) {
$arr['author_xchan'] = $r['hubloc_hash'];
}
$arr['author_xchan'] = $r['hubloc_hash'];
if ($signer) {
$arr['owner_xchan'] = $signer[0]['hubloc_hash'];