fix: hide queue attachment action for messages without attachments

Derive attachment presence from saved queue inputs and only show the preview action when attachments exist. Cover queue metadata and button visibility with regression tests.

Release note: Queued messages without attachments no longer show the View attachments button.
This commit is contained in:
mesalogo
2026-09-23 23:44:08 +08:00
parent c71c0adf9e
commit d5f6dc6990
7 changed files with 44 additions and 2 deletions
+11
View File
@@ -782,7 +782,18 @@ function toSchedule(row: ScheduleWithTaskRow): AssistantSchedule {
function toConversationQueueItem(
row: ConversationQueueRow
): ConversationQueueItem {
let hasAttachments = false
if (row.source === 'user' && row.payload_json) {
try {
const payload = JSON.parse(row.payload_json)
const input = payload?.input ?? payload
hasAttachments = Array.isArray(input?.attachments) && input.attachments.length > 0
} catch {
// Invalid queued payloads are reported when previewed or dispatched.
}
}
return {
hasAttachments,
id: row.id,
conversationId: row.conversation_id,
source: row.source,