fix: update contextType casts to include 'profile', remove stale profileSync comments

This commit is contained in:
Jannis Braun
2026-04-07 14:05:19 +02:00
parent a023c85cad
commit 43900576b2
3 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -931,7 +931,7 @@ export async function federationRoutes(app: FastifyInstance): Promise<void> {
const dmChannelIdFilter = body.dmChannelId && typeof body.dmChannelId === 'string' ? body.dmChannelId : null;
const federatedIdFilter = body.federatedId && typeof body.federatedId === 'string' ? body.federatedId : null;
const contextTypeFilter = body.contextType && typeof body.contextType === 'string'
? body.contextType as 'dm' | 'friend'
? body.contextType as 'dm' | 'friend' | 'profile'
: null;
// Clamp limit: min 1, max 500, default 100
@@ -1103,7 +1103,7 @@ export async function federationRoutes(app: FastifyInstance): Promise<void> {
const payload = mutation.payload ? JSON.parse(mutation.payload) : {};
events.push({
eventType: mutationType as FederationRelayEvent['eventType'],
contextType: (mutation.context_type ?? 'dm') as 'dm' | 'friend',
contextType: (mutation.context_type ?? 'dm') as 'dm' | 'friend' | 'profile',
...(mutation.context_type === 'dm' || !mutation.context_type ? { dmChannelId: mutation.context_id } : {}),
messageId: mutation.entity_id,
encryptionVersion: 0,
+2 -2
View File
@@ -231,7 +231,7 @@ export async function userRoutes(app: FastifyInstance): Promise<void> {
return reply.code(400).send({ error: 'Avatar URL must be a relative upload path or http/https URL', statusCode: 400 });
}
updateData.avatar = avatar;
// Normalize to bare filename — profileSync historically stored /api/uploads/ prefix
// Normalize to bare filename — callers may include /api/uploads/ prefix
if (typeof updateData.avatar === 'string' && updateData.avatar.startsWith('/api/uploads/')) {
updateData.avatar = updateData.avatar.slice('/api/uploads/'.length);
}
@@ -243,7 +243,7 @@ export async function userRoutes(app: FastifyInstance): Promise<void> {
}
if (banner && typeof banner === 'string' && banner.trim().length > 0) {
updateData.banner = banner.trim();
// Normalize to bare filename — profileSync historically stored /api/uploads/ prefix
// Normalize to bare filename — callers may include /api/uploads/ prefix
if (updateData.banner.startsWith('/api/uploads/')) {
updateData.banner = updateData.banner.slice('/api/uploads/'.length);
}
@@ -170,7 +170,7 @@ async function processOutboxTick(): Promise<void> {
const isDm = entry.contextType === 'dm' || !entry.contextType;
const evt: FederationRelayEvent = {
eventType: entry.eventType as FederationRelayEvent['eventType'],
contextType: (entry.contextType ?? 'dm') as 'dm' | 'friend',
contextType: (entry.contextType ?? 'dm') as 'dm' | 'friend' | 'profile',
messageId: entry.entityId ?? '',
encryptionVersion: (entry.encryptionVersion ?? 0) as 0,
timestamp: entry.createdAt,