feat(users): Add bot owner tracking to user profiles
- Add botOwnerHandle field to SwarmUserProfile interface to track bot ownership - Include botOwner relationship in swarm user profile queries for bot users - Populate botOwnerHandle in swarm profile responses when user is a bot - Build botOwner object in local user profile endpoint when fetching remote bot profiles - Include botOwner data in user profile responses for better bot attribution - Enables tracking and displaying which user owns each bot across federated instances
This commit is contained in:
@@ -94,6 +94,16 @@ export async function GET(request: Request, context: RouteContext) {
|
||||
const swarmData = await fetchSwarmProfile(remoteHandle, remoteDomain);
|
||||
if (swarmData?.profile) {
|
||||
const profile = swarmData.profile;
|
||||
|
||||
// Build botOwner object if this is a bot with an owner
|
||||
let botOwner = undefined;
|
||||
if (profile.isBot && profile.botOwnerHandle) {
|
||||
botOwner = {
|
||||
id: `swarm:${remoteDomain}:${profile.botOwnerHandle}`,
|
||||
handle: `${profile.botOwnerHandle}@${remoteDomain}`,
|
||||
};
|
||||
}
|
||||
|
||||
return NextResponse.json({
|
||||
user: {
|
||||
id: `swarm:${remoteDomain}:${profile.handle}`,
|
||||
@@ -111,6 +121,7 @@ export async function GET(request: Request, context: RouteContext) {
|
||||
isSwarm: true,
|
||||
nodeDomain: remoteDomain,
|
||||
isBot: profile.isBot || false,
|
||||
botOwner,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user