diff --git a/backend/spec/requests/posts_spec.rb b/backend/spec/requests/posts_spec.rb index 8f51753..752ac6a 100644 --- a/backend/spec/requests/posts_spec.rb +++ b/backend/spec/requests/posts_spec.rb @@ -898,6 +898,22 @@ RSpec.describe 'Posts API', type: :request do expect(json.fetch('video_ms')).to eq(180_500) end + it 'creates a video post with number input duration seconds' do + sign_in_as(member) + + post '/posts', params: post_write_params( + title: 'video post seconds', + url: 'https://example.com/video-post-seconds', + tags: '動画 spec_tag', + duration: '180.5', + thumbnail: dummy_upload + ) + + expect(response).to have_http_status(:created) + expect(Post.find(json.fetch('id')).video_ms).to eq(180_500) + expect(json.fetch('video_ms')).to eq(180_500) + end + it 'clears video_ms when the saved tags do not include 動画' do sign_in_as(member) diff --git a/frontend/src/lib/posts.test.ts b/frontend/src/lib/posts.test.ts index 724afe4..600df31 100644 --- a/frontend/src/lib/posts.test.ts +++ b/frontend/src/lib/posts.test.ts @@ -70,6 +70,7 @@ describe ('posts API functions', () => { id: 5, title: 'new title', tags: 'tag', + duration: null, parentPostIds: '1 2', originalCreatedFrom: null, originalCreatedBefore: '2026-01-02T00:00:00Z', @@ -82,6 +83,7 @@ describe ('posts API functions', () => { { title: 'new title', tags: 'tag', + duration: null, parent_post_ids: '1 2', original_created_from: null, original_created_before: '2026-01-02T00:00:00Z', diff --git a/frontend/src/pages/theatres/TheatreDetailPage.test.tsx b/frontend/src/pages/theatres/TheatreDetailPage.test.tsx index ccb5407..2c87aba 100644 --- a/frontend/src/pages/theatres/TheatreDetailPage.test.tsx +++ b/frontend/src/pages/theatres/TheatreDetailPage.test.tsx @@ -88,6 +88,10 @@ const weights = buildTheatrePostSelectionWeights ({ tags: [], }], }) +const watchingUsers = [ + { id: 1, name: 'tester' }, + { id: 2, name: 'another' }, +] const renderPage = (user = buildUser ({ id: 1, role: 'member' })) => renderWithProviders ( @@ -136,11 +140,11 @@ const mockDefaultApi = () => { postId: currentPost.id, postStartedAt: '2026-01-02T03:04:05.000Z', postElapsedMs: 1_000, - watchingUsers: [{ id: 1, name: 'tester' }], + watchingUsers, skipVote: { votesCount: 0, requiredCount: 2, - watchingUsersCount: 1, + watchingUsersCount: watchingUsers.length, voted: false, }, })) @@ -150,11 +154,11 @@ const mockDefaultApi = () => { postId: currentPost.id, postStartedAt: '2026-01-02T03:04:05.000Z', postElapsedMs: 2_000, - watchingUsers: [{ id: 1, name: 'tester' }], + watchingUsers, skipVote: { votesCount: 1, requiredCount: 2, - watchingUsersCount: 1, + watchingUsersCount: watchingUsers.length, voted: true, }, })) diff --git a/frontend/src/types.ts b/frontend/src/types.ts index 434a579..2b9b718 100644 --- a/frontend/src/types.ts +++ b/frontend/src/types.ts @@ -356,6 +356,7 @@ export type Tag = { hasWiki: boolean materialId: number | null hasDeerjikists: boolean + children?: Tag[] matchedAlias?: string | null } export type TagVersion = { @@ -370,9 +371,9 @@ export type TagVersion = { createdAt: string createdByUser: { id: number; name: string | null } | null } -export type TagWithSections = Tag & { sections: { beginMs: number - endMs: number | null }[] - children: TagWithSections[] } +export type TagWithSections = Omit & { sections: { beginMs: number + endMs: number | null }[] + children: TagWithSections[] } export type Theatre = { id: number