set default app

This commit is contained in:
Mike Macgirvin 2024-05-01 07:19:28 +10:00
parent 9cd2de9a4f
commit 0e9914b268
3 changed files with 22 additions and 3 deletions

View file

@ -2657,11 +2657,11 @@ function xchan_query(&$items, $abook = true, $effective_uid = 0)
if ($abook) {
$chans = q(
"select * from xchan left join hubloc on hubloc_hash = xchan_hash left join abook on abook_xchan = xchan_hash and abook_channel = %d
where xchan_hash in (" . protect_sprintf(implode(',', $arr)) . ") and hubloc_deleted = 0 order by hubloc_primary desc",
left join site on site_url = hubloc_url where xchan_hash in (" . protect_sprintf(implode(',', $arr)) . ") and hubloc_deleted = 0 order by hubloc_primary desc",
intval($item['uid'])
);
} else {
$chans = q("select xchan.*,hubloc.* from xchan left join hubloc on hubloc_hash = xchan_hash
$chans = q("select xchan.*,hubloc.* from xchan left join hubloc on hubloc_hash = xchan_hash left join site on site_url = hubloc_url
where xchan_hash in (" . protect_sprintf(implode(',', $arr)) . ") and hubloc_deleted = 0 order by hubloc_primary desc");
}
$xchans = q("select * from xchan where xchan_hash in (" . protect_sprintf(implode(',', $arr)) . ") and xchan_network in ('rss','unknown', 'anon')");

View file

@ -163,6 +163,22 @@ function xchan_store($arr)
return true;
}
function xchan_project($xchan)
{
if (!empty($xchan['xchan_url'])) {
$parsed = parse_url($xchan['xchan_url']);
if ($parsed) {
$url = $parsed['scheme'] . '://' . $parsed['host'];
$record = q("select site_project from site where site_url = '%s'",
dbesc($url)
);
if ($record) {
return $record[0]['site_project'];
}
}
}
return '';
}
function xchan_match($arr)
{

View file

@ -410,7 +410,10 @@ class ThreadItem
if (!$locicon) {
$locicon = ($item['verb'] === 'Leave') ? '<i class="fa fa-fw fa-sign-out"></i>&nbsp' : '';
}
$author_app = $item['author']['site_project'] ?? '';
if (empty($item['app'])) {
$item['app'] = $author_app;
}
$isContained = $thread_level === 1 && str_contains($item['tgt_type'],'Collection');
$tmp_item = [