mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 00:35:30 +00:00
nomadic posts and item fetches
This commit is contained in:
parent
6e924ee3a3
commit
c1245fbeb7
1 changed files with 20 additions and 43 deletions
|
@ -73,8 +73,9 @@ class Item extends Controller
|
|||
// add preferential bias to item owners (item_wall = 1)
|
||||
|
||||
$r = q(
|
||||
"select * from item where (mid = '%s' or uuid = '%s') $item_normal order by item_wall desc limit 1",
|
||||
dbesc(z_root() . '/item/' . $item_uuid),
|
||||
"select * from item where ((mid like '%s' and mid like '%s') or uuid = '%s') $item_normal order by item_wall desc limit 1",
|
||||
dbesc(z_root() . '%'),
|
||||
dbesc('%/item/' . $item_uuid),
|
||||
dbesc($item_uuid)
|
||||
);
|
||||
|
||||
|
@ -118,8 +119,9 @@ class Item extends Controller
|
|||
// If any of these have our request uri as a child, make that the head of the conversation we are going to return.
|
||||
// Otherwise keep looking.
|
||||
foreach ($j as $test) {
|
||||
$candidate = q("select id as item_id from item where (mid = '%s' or uuid = '%s') and parent = %d ",
|
||||
dbesc(z_root() . '/item/' . $item_uuid),
|
||||
$candidate = q("select id as item_id from item where ((mid like '%s' and mid like '%s') or uuid = '%s') and parent = %d ",
|
||||
dbesc(z_root() . '%'),
|
||||
dbesc('%/item/' . $item_uuid),
|
||||
dbesc($item_uuid),
|
||||
intval($test['item_id'])
|
||||
);
|
||||
|
@ -204,8 +206,9 @@ class Item extends Controller
|
|||
// do we have the item (at all)?
|
||||
|
||||
$r = q(
|
||||
"select * from item where (mid = '%s' or uuid = '%s') $item_normal limit 1",
|
||||
dbesc(z_root() . '/item/' . $item_uuid),
|
||||
"select * from item where ((mid like '%s' and mid like '%s') or uuid = '%s') $item_normal limit 1",
|
||||
dbesc(z_root() . '%'),
|
||||
dbesc('%/item/' . $item_uuid),
|
||||
dbesc($item_uuid)
|
||||
);
|
||||
|
||||
|
@ -301,9 +304,9 @@ class Item extends Controller
|
|||
}
|
||||
|
||||
$i = Activity::encode_item_collection($items, 'conversation/' . $item_uuid, 'OrderedCollection', true, z_root() . '/channel/' . $chan['channel_address'], count($items));
|
||||
if ($portable_id && (!intval($items[0]['item_private']))) {
|
||||
ThreadListener::store(z_root() . '/item/' . $item_uuid, $portable_id);
|
||||
}
|
||||
// if ($portable_id && (!intval($items[0]['item_private']))) {
|
||||
// ThreadListener::store(z_root() . '/item/' . $item_uuid, $portable_id);
|
||||
// }
|
||||
|
||||
if (!$i) {
|
||||
http_status_exit(404, 'Not found');
|
||||
|
@ -328,9 +331,10 @@ class Item extends Controller
|
|||
|
||||
if (argc() > 1 && argv(1) !== 'drop') {
|
||||
$x = q(
|
||||
"select uid, item_wall, llink, mid from item where mid = '%s' or mid = '%s' or uuid = '%s'",
|
||||
dbesc(z_root() . '/item/' . argv(1)),
|
||||
dbesc(z_root() . '/activity/' . argv(1)),
|
||||
"select uid, item_wall, llink, mid from item where mid like '%s' and mid like '%s' or mid like '%s' or uuid = '%s'",
|
||||
dbesc(z_root() . '%'),
|
||||
dbesc('%/item/' . argv(1)),
|
||||
dbesc('%/activity/' . argv(1)),
|
||||
dbesc(argv(1))
|
||||
);
|
||||
if ($x) {
|
||||
|
@ -1352,7 +1356,7 @@ class Item extends Controller
|
|||
$mid = $message_id;
|
||||
} else {
|
||||
$uuid = new_uuid();
|
||||
$mid = z_root() . '/item/' . $uuid;
|
||||
$mid = Channel::getDidResolver($channel) . '/item/' . $uuid;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1365,7 +1369,7 @@ class Item extends Controller
|
|||
$datarray['target'] = [
|
||||
'id' => str_replace('/item/', '/conversation/', $conversation),
|
||||
'type' => 'Collection',
|
||||
'attributedTo' => z_root() . '/channel/' . $channel['channel_address'],
|
||||
'attributedTo' => Channel::getDidResolver($channel) . '/channel/' . $channel['channel_address'],
|
||||
];
|
||||
$datarray['tgt_type'] = 'Collection';
|
||||
}
|
||||
|
@ -1421,36 +1425,9 @@ class Item extends Controller
|
|||
$item_thread_top = ((!$parent) ? 1 : 0);
|
||||
|
||||
|
||||
// fix permalinks for cards, etc.
|
||||
|
||||
if ($webpage == ITEM_TYPE_CARD) {
|
||||
$plink = z_root() . '/cards/' . $channel['channel_address'] . '/' . (($pagetitle) ? $pagetitle : $uuid);
|
||||
}
|
||||
if (($parent_item) && ($parent_item['item_type'] == ITEM_TYPE_CARD)) {
|
||||
$r = q(
|
||||
"select v from iconfig where iconfig.cat = 'system' and iconfig.k = 'CARD' and iconfig.iid = %d limit 1",
|
||||
intval($parent_item['id'])
|
||||
);
|
||||
if ($r) {
|
||||
$plink = z_root() . '/cards/' . $channel['channel_address'] . '/' . $r[0]['v'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($webpage == ITEM_TYPE_ARTICLE) {
|
||||
$plink = z_root() . '/articles/' . $channel['channel_address'] . '/' . (($pagetitle) ? $pagetitle : $uuid);
|
||||
}
|
||||
if (($parent_item) && ($parent_item['item_type'] == ITEM_TYPE_ARTICLE)) {
|
||||
$r = q(
|
||||
"select v from iconfig where iconfig.cat = 'system' and iconfig.k = 'ARTICLE' and iconfig.iid = %d limit 1",
|
||||
intval($parent_item['id'])
|
||||
);
|
||||
if ($r) {
|
||||
$plink = z_root() . '/articles/' . $channel['channel_address'] . '/' . $r[0]['v'];
|
||||
}
|
||||
}
|
||||
|
||||
if ((!(isset($plink) && $plink)) && $item_thread_top) {
|
||||
$plink = z_root() . '/item/' . $uuid;
|
||||
$plink = Channel::getDidResolver($channel) . '/item/' . $uuid;
|
||||
}
|
||||
|
||||
if (array_path_exists('obj/id', $datarray)) {
|
||||
|
@ -2081,7 +2058,7 @@ class Item extends Controller
|
|||
$obj['to'] = Activity::map_acl($item);
|
||||
} else {
|
||||
$obj['to'] = [ACTIVITY_PUBLIC_INBOX];
|
||||
$obj['cc'] = [z_root() . '/followers/' . $channel['channel_address']];
|
||||
$obj['cc'] = [Channel::getDidResolver($channel) . '/followers/' . $channel['channel_address']];
|
||||
}
|
||||
|
||||
$tags = Activity::encode_taxonomy(['term' => $term]);
|
||||
|
|
Loading…
Reference in a new issue