mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-25 00:39:25 +00:00
* fix(premiere-uxp): scope sequence links by server endpoint and surface sync errors - Add optional endpoint property to LinkedSequenceAsset to record originating server - Implement normalizeEndpoint and isSameEndpoint helpers in utils/url - Skip polling foreign sequence links in autoSyncService when connected to a different server - Display informative Server: <host> badge and disable manual sync with tooltip for foreign links in SequencesView - Guard comment fallback in removeSequenceLink and link matching in FileListView by endpoint - Throw on non-200 responses in fetchAssetComments and display error toast on failed manual sync - Add comprehensive unit tests covering endpoint normalization, foreign link skipping, and error toast handling - Rebuild and package shumai-premiere.ccx * fix(premiere-uxp): filter out foreign endpoint sequence links from sequences tab - Filter all sequence links in SequencesView to only display links matching the current server endpoint - Filter existing sequence links in LinkSequenceDialog by endpoint so foreign sequences appear as ready to link on the current server - Ensure onLinkCountChange in FileListView and SequencesView only counts sequences linked to the active server - Add 'Browse Assets to Link' action button to the SequencesView unified empty state - Update SequencesView tests to verify foreign links are completely hidden and link counts are scoped - Rebuild and package shumai-premiere.ccx * fix(premiere-uxp): show file creation time on cards and remove sequence icon in link dialog * fix(premiere-uxp): remove browse button in sequences empty state
44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
import type { CommentInfo } from '@shumai/dtos'
|
|
import { getShumaiClient } from '../api/client'
|
|
|
|
/**
|
|
* Fetches timecoded comments for an asset from Shumai.
|
|
*/
|
|
export async function fetchAssetComments(
|
|
endpoint: string,
|
|
apiKey: string,
|
|
assetId: string,
|
|
): Promise<CommentInfo[]> {
|
|
const client = getShumaiClient(endpoint, apiKey)
|
|
const res = await client.api.files[':fileId'].comments.$get({
|
|
param: { fileId: assetId },
|
|
query: { first: '100' },
|
|
})
|
|
|
|
if (!res.ok) {
|
|
const errData = (await res.json().catch(() => ({}))) as { error?: string }
|
|
throw new Error(errData.error || `Failed to fetch comments (HTTP ${res.status})`)
|
|
}
|
|
|
|
const data = await res.json()
|
|
return (data?.data as CommentInfo[]) || []
|
|
}
|
|
|
|
/**
|
|
* Formats a Shumai comment into marker text including any threaded replies.
|
|
*/
|
|
export function formatCommentBody(comment: CommentInfo): string {
|
|
let body = comment.message || ''
|
|
|
|
if (comment.replies && comment.replies.length > 0) {
|
|
body += '\n\n--- Replies ---'
|
|
for (const reply of comment.replies) {
|
|
const author = reply.creator?.name || 'User'
|
|
const replyMsg = reply.message || ''
|
|
body += `\n${author}: ${replyMsg}`
|
|
}
|
|
}
|
|
|
|
return body
|
|
}
|