linked identities continued

This commit is contained in:
Mike Macgirvin 2023-05-01 22:28:35 -07:00
parent 642c2835a6
commit 36d1319132
3 changed files with 22 additions and 6 deletions

View file

@ -176,9 +176,8 @@ class Manage extends Controller
);
$linkid_str = ids_to_querystr($links,'link', true);
if ($linkid_str) {
$linkedIdentities = q("select * from xchan where xchan_hash in (%s)",
dbesc($linkid_str)
);
$linkedIdentities = q("select * from xchan where (xchan_hash in ($linkid_str) and xchan_network = 'activitypub')
or (xchan_url in ($linkid_str) and xchan_network in ('zot6','nomad')) ");
}
}
@ -195,6 +194,18 @@ class Manage extends Controller
$delegates = null;
}
if ($linkedIdentities) {
for ($x = 0; $x < count($linkedIdentities); $x++) {
$linkedIdentities[$x]['link'] = zid($linkedIdentities[$x]['xchan_url']);
$linkedIdentities[$x]['channel_name'] = $linkedIdentities[$x]['xchan_name'];
$linkedIdentities[$x]['delegate'] = 2;
$linkedIdentities[$x]['collections_label'] = t('Collection');
}
} else {
$linkedIdentities = null;
}
return replace_macros(Theme::get_template('channels.tpl'), [
'$header' => t('Channels'),
'$msg_selected' => t('Current Channel'),
@ -210,6 +221,7 @@ class Manage extends Controller
'$mail_format' => t('%d new messages'),
'$intros_format' => t('%d new introductions'),
'$channel_usage_message' => $channel_usage_message,
'$remote_desc' => t('Linked Identity'),
'$delegated_desc' => t('Delegated Channel'),
'$delegates' => $delegates,
'$links' => $linkedIdentities,

View file

@ -5,6 +5,7 @@ namespace Code\Web;
use App;
use Code\Lib\Activity;
use Code\Lib\Channel;
use Code\Lib\PConfig;
use Code\Extend\Hook;
class WebServer
@ -185,7 +186,7 @@ class WebServer
$channel = Channel::from_username(argv(1));
if ($channel) {
$nomadicIds = Activity::nomadic_locations(['author_xchan' => $channel['channel_hash']]);
$linkedIds = PConfig::Get($channel['channel_hash'],'system','identities', []);
$linkedIds = PConfig::Get($channel['channel_id'],'system','identities', []);
}
App::$channel_links = [
[

View file

@ -2,15 +2,18 @@
<div class="float-end">
{{if $channel.default_links}}
{{/if}}
{{if $channel.delegate}}
{{if $channel.delegate == 1}}
{{$delegated_desc}}
{{/if}}
{{if $channel.delegate == 2}}
{{$remote_desc}}
{{/if}}
</div>
<h3>
{{*if $selected == $channel.channel_id}}
<i class="fa fa-circle text-success" title="{{$msg_selected}}"></i>
{{/if*}}
{{if $channel.delegate}}
{{if $channel.delegate == 1}}
<i class="fa fa-arrow-circle-right" title="{{$delegated_desc}}"></i>
{{/if}}
{{if $channel.xchan_type == 2}}<i class="fa fa-tags" title="{{$channel.collections_label}}"></i>&nbsp;{{elseif $channel.xchan_type == 1}}<i class="fa fa-comments-o" title="{{$channel.forum_label}}"></i>&nbsp;{{/if}}