fix(federation): set correct homeInstance in relay payload and fix canonical backfill SQL

- buildRelayPayload now uses config.domain for local users instead of
  empty string, so the relay receiver can resolve the user
- Fixed canonical_pair_id backfill: SQLite NULL || ':' || x = NULL,
  so use COALESCE(home_user_id, id) instead of concatenation
This commit is contained in:
Jannis Braun
2026-03-26 04:19:18 +01:00
parent 4a109f71da
commit 960ca1c97f
2 changed files with 6 additions and 13 deletions
@@ -4,6 +4,7 @@ import { eq, and } from 'drizzle-orm';
import { generateSnowflake } from './snowflake.js';
import crypto from 'node:crypto';
import type { FederationRelayEvent } from '@backspace/shared';
import { config } from '../config.js';
// ─── Settings Cache ──────────────────────────────────────────────────────────
@@ -230,7 +231,7 @@ export function buildRelayPayload(
return {
userId: user.id,
homeUserId: user.homeUserId || user.id,
homeInstance: user.homeInstance || '',
homeInstance: user.homeInstance || config.domain || '',
content: message.content,
replyToId: message.replyToId ?? null,
editedAt: message.editedAt ?? null,