feat(guild): add 'dm' x-type (private 1:1, always-wake)
channel enum + X_TYPES + realtime XType gain 'dm'. dm channels are forced private (never public) and non-unique (no dedup; create() always makes a fresh one). computeWakeup: dm wakes every non-author participant unconditionally (no rotation / no wake_mapping). The message.created realtime payload now carries xType so the plugin can treat dm specially. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -11,7 +11,7 @@ import { Logger } from '@nestjs/common';
|
||||
import { Server, Socket } from 'socket.io';
|
||||
import { introspectGuildToken } from '../common/center-auth.js';
|
||||
|
||||
type XType = 'general' | 'work' | 'report' | 'discuss' | 'triage' | 'custom';
|
||||
type XType = 'general' | 'work' | 'report' | 'discuss' | 'triage' | 'custom' | 'dm';
|
||||
|
||||
// Wakeup for non-rotating channels only (general/report/triage/custom).
|
||||
// discuss/work go through TurnService + emitMessageTargeted, never here.
|
||||
@@ -40,6 +40,9 @@ export function computeWakeup(args: {
|
||||
case 'triage':
|
||||
case 'custom':
|
||||
return wakeUserIds.has(recipientUserId);
|
||||
case 'dm':
|
||||
// 1:1 conversation: every non-author participant is always woken.
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -189,7 +192,7 @@ export class RealtimeGateway implements OnGatewayConnection, OnGatewayDisconnect
|
||||
wakeUserIds: ctx.wakeUserIds,
|
||||
mentionUserIds: ctx.mentionUserIds,
|
||||
});
|
||||
s.emit('message.created', { ...data, channelId, wakeup });
|
||||
s.emit('message.created', { ...data, channelId, wakeup, xType: ctx.xType });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user