Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
feat(music-video): show how many platforms are left in the Publish header action (#10343)
Adam Eivye1d563f582d7
diff --git a/client/src/lib/musicVideoStages.js b/client/src/lib/musicVideoStages.jsindex c942bca911..c2480314ee 100644--- a/client/src/lib/musicVideoStages.js+++ b/client/src/lib/musicVideoStages.js@@ -477,10 +477,11 @@ export function deriveNextAction(project, {if (!project.publishKit?.builtAt) return { id: 'goto-publish', kind: 'goto', stage: 'publish', label: 'Build the publishing kit', shortLabel: 'Kit' };// One platform at a time, never "publish everything": the next platform// not yet posted, so a click can't repeat a post that already went out.- const next = publishPlatformProgress(project, publish).rows.find((row) => row.state !== 'posted');+ const { rows, total, posted } = publishPlatformProgress(project, publish);+ const next = rows.find((row) => row.state !== 'posted');return next- ? { id: 'goto-publish', kind: 'goto', stage: 'publish', anchor: publishRowAnchor(next.target), label: `Next: post to ${next.label}`, shortLabel: next.label }- : { id: 'goto-publish', kind: 'goto', stage: 'publish', anchor: PUBLISH_ANCHOR, label: 'Open publishing', shortLabel: 'Publish' };+ ? { id: 'goto-publish', kind: 'goto', stage: 'publish', anchor: publishRowAnchor(next.target), label: `Next: post to ${next.label} · ${total - posted} left`, shortLabel: next.label }+ : { id: 'goto-publish', kind: 'goto', stage: 'publish', anchor: PUBLISH_ANCHOR, label: total ? 'All posted' : 'Open publishing', shortLabel: 'Publish' };}default:if (isFinalRenderStale(project)) {diff --git a/client/src/lib/musicVideoStages.test.js b/client/src/lib/musicVideoStages.test.jsindex 52c5fc7e25..97fb466c58 100644--- a/client/src/lib/musicVideoStages.test.js+++ b/client/src/lib/musicVideoStages.test.js@@ -112,7 +112,10 @@ describe('deriveStages / deriveNextAction', () => {const kitBuilt = { ...finished, publishKit: { builtAt: '2026-01-01T00:00:00.000Z', posts: { youtube: { url: 'https://example.com/v' } } } };const publish = { targets: [{ target: 'youtube', label: 'YouTube' }, { target: 'distrokid', label: 'Spotify (via DistroKid)' }] };expect(deriveNextAction({ ...finished, publishKit: { builtAt: '2026-01-01T00:00:00.000Z' } })).toMatchObject({ label: 'Open publishing', anchor: 'mv-publish-kit' });- expect(deriveNextAction(kitBuilt, { publish })).toMatchObject({ label: 'Next: post to Spotify (via DistroKid)', anchor: 'mv-post-distrokid' });+ expect(deriveNextAction(kitBuilt, { publish })).toMatchObject({ label: 'Next: post to Spotify (via DistroKid) · 1 left', anchor: 'mv-post-distrokid' });+ // Every enabled platform posted: nothing left to do here, and no bulk-post wording.+ const allPosted = { ...kitBuilt, publishKit: { ...kitBuilt.publishKit, posts: { youtube: { url: 'https://example.com/v' }, distrokid: { url: 'https://example.com/s' } } } };+ expect(deriveNextAction(allPosted, { publish })).toMatchObject({ label: 'All posted', anchor: 'mv-publish-kit' });expect(stageChecklist('publish', kitBuilt, undefined, publish).find((i) => i.id === 'post-distrokid').action).toEqual({ label: 'Post here', anchor: 'mv-post-distrokid' });expect(stateOf({ ...finished, publishKit: { posts: { youtube: { url: 'https://example.com/v' } } } }).publish).toBe('done');});diff --git a/server/routes/musicVideoProductionReview.test.js b/server/routes/musicVideoProductionReview.test.jsindex 9459eba559..0e4e04c296 100644--- a/server/routes/musicVideoProductionReview.test.js+++ b/server/routes/musicVideoProductionReview.test.js@@ -353,6 +353,10 @@ describe('human-reviewed Music Video workflow', () => {auth.authenticated = true;expect((await request(app).post(`${base}/publish/youtube/prepare`).set('authorization', 'Bearer synthetic-agent').send({})).status).toBe(200);expect(prepareExternalDraft).toHaveBeenCalledWith(project.id, 'youtube', expect.any(Object));+ // The "post again" confirmation reaches the service; a non-boolean is refused.+ expect((await request(app).post(`${base}/publish/youtube/prepare`).set('authorization', 'Bearer synthetic-agent').send({ again: true })).status).toBe(200);+ expect(prepareExternalDraft).toHaveBeenLastCalledWith(project.id, 'youtube', { again: true });+ expect((await request(app).post(`${base}/publish/youtube/prepare`).set('authorization', 'Bearer synthetic-agent').send({ again: 'yes' })).status).toBe(400);});});diff --git a/server/services/musicVideo/publish/index.js b/server/services/musicVideo/publish/index.jsindex 0bbe31cef8..0fa855d8d4 100644--- a/server/services/musicVideo/publish/index.js+++ b/server/services/musicVideo/publish/index.js@@ -157,8 +157,10 @@ export async function preparePublishDraft(projectId, target, options = {}, depsif (!project) throw new ServerError('Project not found', { status: 404, code: 'NOT_FOUND' });// A platform already posted to gets a second draft only when the director says so:// otherwise one stray click is one duplicate post.- if (project.publishKit?.posts?.[target] && options.again !== true) {- throw new ServerError(`Already posted to ${adapter.label}. Confirm "Post again" to fill another draft`, { status: 409, code: 'PUBLISH_ALREADY_POSTED' });+ const existing = project.publishKit?.posts?.[target];+ if (existing && options.again !== true) {+ const urls = existing.url ? [existing.url] : [];+ throw new ServerError(`Already posted to ${adapter.label}. Confirm "Post again" to fill another draft`, { status: 409, code: 'PUBLISH_ALREADY_POSTED', context: { target, urls } });}let payload = resolveFiles(buildPublishPayload(target, project, withPlatformDefaults(target, options, platforms)));payload = await withAudio(target, payload, project, deps);diff --git a/server/services/musicVideo/publish/index.test.js b/server/services/musicVideo/publish/index.test.jsindex 0e64161d5f..ee2c581912 100644--- a/server/services/musicVideo/publish/index.test.js+++ b/server/services/musicVideo/publish/index.test.js@@ -188,7 +188,7 @@ describe('publish drafts (#9282)', () => {// Once posted, a second draft (a duplicate post) needs the director's explicit "again".await recordPublishPost(id, 'youtube', { url: 'https://www.youtube.com/watch?v=example' });connect.mockClear();- await expect(preparePublishDraft(id, 'youtube', {}, { connect, adapters, platforms })).rejects.toMatchObject({ status: 409, code: 'PUBLISH_ALREADY_POSTED' });+ await expect(preparePublishDraft(id, 'youtube', {}, { connect, adapters, platforms })).rejects.toMatchObject({ status: 409, code: 'PUBLISH_ALREADY_POSTED', context: { target: 'youtube', urls: ['https://www.youtube.com/watch?v=example'] } });expect(connect).not.toHaveBeenCalled();await preparePublishDraft(id, 'youtube', { again: true }, { connect, adapters, platforms });expect(adapters.youtube.prepare).toHaveBeenCalledTimes(2);