fix: use work items as dashboard outbound SSOT
This commit is contained in:
@@ -136,7 +136,7 @@ describe('DiscordChannel structured output', () => {
|
||||
};
|
||||
clientRef.current.channels.fetch.mockResolvedValue(mockChannel);
|
||||
|
||||
await channel.sendMessage(
|
||||
const result = await channel.sendMessage(
|
||||
'dc:1234567890123456',
|
||||
JSON.stringify({
|
||||
ejclaw: {
|
||||
@@ -154,6 +154,11 @@ describe('DiscordChannel structured output', () => {
|
||||
}),
|
||||
);
|
||||
|
||||
expect(result).toMatchObject({
|
||||
primaryMessageId: 'discord-message-1',
|
||||
messageIds: ['discord-message-1'],
|
||||
visible: true,
|
||||
});
|
||||
expect(mockChannel.send).toHaveBeenCalledWith({
|
||||
content: '라벨 좌측 클리핑 회귀 수정했습니다.',
|
||||
files: [
|
||||
|
||||
@@ -22,7 +22,7 @@ import { logger } from '../logger.js';
|
||||
import { validateOutboundAttachments } from '../outbound-attachments.js';
|
||||
import { formatOutbound } from '../router.js';
|
||||
import { hasReviewerLease } from '../service-routing.js';
|
||||
import type { SendMessageOptions } from '../types.js';
|
||||
import type { SendMessageOptions, SendMessageResult } from '../types.js';
|
||||
import { prepareDiscordOutbound } from './discord-outbound.js';
|
||||
|
||||
const ATTACHMENTS_DIR = path.join(DATA_DIR, 'attachments');
|
||||
@@ -408,7 +408,7 @@ export class DiscordChannel implements Channel {
|
||||
jid: string,
|
||||
text: string,
|
||||
options: SendMessageOptions = {},
|
||||
): Promise<void> {
|
||||
): Promise<SendMessageResult> {
|
||||
if (!this.client) {
|
||||
throw new Error('Discord client not initialized');
|
||||
}
|
||||
@@ -429,7 +429,7 @@ export class DiscordChannel implements Channel {
|
||||
{ jid, channelName: this.name },
|
||||
'Skipping silent structured Discord outbound message',
|
||||
);
|
||||
return;
|
||||
return { primaryMessageId: null, messageIds: [], visible: false };
|
||||
}
|
||||
const validation = validateOutboundAttachments(outbound.attachments, {
|
||||
baseDirs: options.attachmentBaseDirs,
|
||||
@@ -478,7 +478,7 @@ export class DiscordChannel implements Channel {
|
||||
{ jid, channelName: this.name },
|
||||
'Skipping empty Discord outbound message',
|
||||
);
|
||||
return;
|
||||
return { primaryMessageId: null, messageIds: [], visible: false };
|
||||
}
|
||||
|
||||
// Split files into batches of MAX_ATTACHMENTS
|
||||
@@ -546,6 +546,11 @@ export class DiscordChannel implements Channel {
|
||||
},
|
||||
'Discord message sent',
|
||||
);
|
||||
return {
|
||||
primaryMessageId: sentMessageIds[0] ?? null,
|
||||
messageIds: sentMessageIds,
|
||||
visible: chunkCount > 0,
|
||||
};
|
||||
} catch (err) {
|
||||
logger.error(
|
||||
{ jid, channelName: this.name, err },
|
||||
|
||||
Reference in New Issue
Block a user