The Shorts feed used to emit one <video id="sv-{idx}"> per short. With
60 shorts, that was 60 HTMLMediaElement allocations even though only
one plays at a time — bandwidth was bounded by preload="none" but the
DOM shape was still N:1.
Replace with the YT-parity architecture:
- One #svGlobal <video> rendered once at the end of the feed. The
IntersectionObserver docks it into the active .short-player-wrap on
entry and sets its src from the slot's data-src. Browsers preserve
the active media context across node moves so playback doesn't
restart just because we re-parented the node.
- Per-slot .short-poster shim keeps the slot filled with the video's
thumbnail while the shared player is docked elsewhere; the slot
never goes blank between swaps.
- Two #svPre1 / #svPre2 preloaders park at the end of the DOM and get
their src set to the NEXT one and two shorts on each dock. preload=
"metadata" grabs the moov atom + first keyframe only — enough that
the switch to playback is instant, cheap enough that we can run two.
- The <video>'s single timeupdate listener now updates the
.short-progress-fill of whichever slot it's currently docked in,
found via video.parentElement.id.replace('wrap-', '').
- toggleMute now mutes the shared video directly instead of looking
up the no-longer-existent sv-{idx} by id.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Two provably-unreachable blocks in resources/views/videos/types/match.blade.php
whose cascade targets are overridden further down with !important:
1. The pre-override pair at ~line 320:
.events-sidebar { display: none; }
.events-sidebar.show { display: flex; }
is overridden by the primary .events-sidebar definition further down
that sets `display: none !important` and `.show { display: flex !important }`.
2. The first `@media (max-width: 1300px)` block that sized
.yt-sidebar-container + .events-sidebar to 300 px is overridden by the
SECOND `@media (max-width: 1300px)` block immediately after, which sets
both to `width: 100% !important` as part of the stacking layout. Same
breakpoint, same selectors, !important wins.
Both removals leave Blade comments in place so the next reader can see why
the gap is there. Smoke-tested: /, /videos still 200; full test suite
80/80 green. Full consolidation of the four responsive .events-sidebar
variants (desktop, 1300 px stacking, 991 px bottom sheet, fullscreen
drawer) is left for a future turn with a browser visual-regression
harness — each variant has a distinct behavior that would be risky to
merge without one.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Covers Private visibility acceptance, ended-state Watch page shows
"Stream ended" (and omits the "Waiting for the broadcast" placeholder
from the connection JS), channel-name link resolves to the user's
channel URL, chat poll returns messages newer than ?since=, chat send
rejects guests (401), chat send rejects offline streams (422), and
private-stream chat 404s for non-owners.
Also broadens LiveStream::isWatchableBy to keep public/unlisted
streams permalinked after they end — viewers now see the Stream Ended
card and the Watch Replay CTA instead of a hard 404.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Restores the live streaming controllers / views / model from the
pre-audit WIP that got stashed on 2026-10-21, then applies the Phase 6
polish items:
## /live/new form
Add a Private visibility option that mirrors the upload modal's
wording — "Only you can see this stream. Perfect for testing without
an audience." Validator in LiveStreamController@store now permits
public|unlisted|private (was public|unlisted).
## Watch page ended-state
When the stream status is "ended", the overlay is a solid "Stream
ended" card showing the stream's duration (started_at → ended_at)
and, when a recording was published, a Watch Replay CTA linking to
the saved video. Previously an ended stream showed the generic
"Waiting for the broadcast to start" placeholder forever.
## Channel name link
The uploader's name in the meta row is now a real <a href> to the
channel page.
## Viewer action row
Subscribe + Share buttons below the player, visible to anyone except
the owner. Subscribe for guests uses the Phase 7 ?intended= pattern
so after sign-in they land back on the stream.
## Live chat (DB-backed polling)
New live_chat_messages table (migration 2026_10_21_000003). Viewers
GET /live/{stream}/chat?since=N every 3 seconds; signed-in users POST
to the same path (rate-limited at 60/min). Guests see the panel in
read-only mode with a "Sign in to chat" placeholder.
Private streams reject chat for anyone but the owner (404). Non-live
status rejects chat sends (422). Author name is snapshotted at post
time so a renamed account's old messages keep the name they used.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Ten tests spanning the eight commits in this branch:
- Player end-screen markup present (overlay + ring + cancel hooks).
- C hotkey binds to #ytpLyricsBtn in the player keydown handler.
- Guest Subscribe button carries ?intended= and encodeURIComponent.
- /@handle/videos 302s to the hash URL; nonsense tabs 404.
- /channel/{username}/videos/more returns a cursor-paginated JSON
payload with items + next_cursor + has_more.
- /studio redirects anonymous visitors to login.
- /studio renders only the signed-in user's videos.
- Studio bulk visibility + bulk delete scope updates to Auth::id().
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Skeleton for the creator studio surface deferred since Phase 6. The
/studio route lands on a filterable table of the signed-in user's
videos — All / Public / Unlisted / Private / Shorts / Processing-or-
Failed — with headline totals (public / unlisted / private counts,
processing + failed, total views) in a stat strip above.
Each row shows thumbnail + title + stripped description preview +
visibility badge + per-video totals. Row-level checkboxes raise a
toolbar when any row is selected; the toolbar supports:
- Change visibility across the selection (any of the three visibility
enums).
- Delete the selection with a confirm prompt.
Server-side the bulk endpoints owner-filter by Auth::id() so a crafted
request body can't flip or delete anyone else's videos. Response is
JSON { updated | deleted : N } so the page can reload / toast cleanly.
Sidebar now carries a persistent "Studio" link under the You section
alongside History / Liked Videos.
Analytics, stepped upload (Details → Visibility), and schedule remain
future work — this ships the content management surface, nothing else.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Previous commit added the HTML + CSS for the comments pane but the JS
handlers only landed in the first (markup) Edit. This drops the two
window.short*Comments functions into the IIFE so the onclick handlers
in the markup actually resolve.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The comments icon on each Short used to open the full /videos/{id}
page, kicking the viewer out of the vertical feed. Now it opens a
shared side drawer on desktop (right edge, 420px wide, starts below
the header) or a bottom sheet on mobile (70vh, slides up from the
bottom nav), without leaving the feed.
Content is the same resources/views/components/video-comments
section rendered on the watch page — fetched as XHR and the whole
#ytcSection node is lifted into the pane. All the existing comment
features (replies, likes, translate, heart/pin, permalinks) work
identically because we're reusing the exact same DOM.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Two complementary additions that share the same bridge-not-rewrite
philosophy — reuse the existing single-page channel view instead of
splitting its 2000 lines into five route-driven partials.
/@handle/{tab}: videos / shorts / playlists / posts / about / wall
redirect to the equivalent /channel/{slug}#tab URL (302). The channel
page's existing hash-tab JS already handles landing on the right tab;
these aliases just make the URLs shareable in the YouTube style.
Channel Videos tab Load More: new JSON endpoint
GET /channel/{username}/videos/more returns the next cursor page of
server-rendered video cards. A sentinel + IntersectionObserver below
the grid fetches the next page when scrolled into view, with a Load
More button as fallback. Behavior mirrors the Phase 2 home feed —
users with thousands of uploads no longer get a 300-item grid on
first paint.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Clicking Subscribe as a guest used to redirect straight to /login with no
context. Now a short toast tells the visitor "Sign in to subscribe to
{channel}" and the redirect carries ?intended=<current path> so after
login they land back on the same video instead of the home page.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
YT parity. "C" clicks the visible #ytpLyricsBtn when there is one (music
type), no-op otherwise so hitting C next to K / L / M on a plain video
doesn't trigger something unexpected.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
When a video finishes and autoplay is on, instead of switching to the
next recommendation silently we show a YouTube-style end screen with
the next video's thumbnail, title and a radial countdown. The viewer
can Cancel to stay put, Play Now to skip the countdown, or just wait
and the existing _plOnVideoEnd / navigateNext handoff fires at zero.
End screen is skipped entirely when there's no sidebar card to show
or when loop is on (loop keeps the old same-video behavior).
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Three features that depend on the two additive migrations shipped in
the same commit (safe defaults, cascading foreign keys, no data loss
possible).
## Dislike button
- New video_dislikes table (migration 2026_10_21_000001) with the same
shape as video_likes.
- Video model: dislikes() relation + isDislikedBy() / getDislikeCount
Attribute() helpers mirroring the like pair.
- UserController@toggleDislike: endpoint behind POST
/videos/{video}/toggle-dislike. Mutually exclusive with like — the
toggle*Like / toggle*Dislike controllers detach the opposite state
so a user is in exactly one of {liked, disliked, neither}. YouTube
parity.
- video-actions component: a second thumbs-down button next to the
existing like. Both reconcile in parallel on either response so the
UI pair always reflects the authoritative server state.
## Creator heart + pin
- comments table gains hearted + pinned boolean columns (migration
2026_10_21_000002, both default false, pinned is indexed).
- CommentController@heart + @pin: 403 for anyone but the video owner;
pin() also rejects nested replies (422) and auto-unpins the
previously-pinned top-level comment so the "at most one pinned"
invariant is enforced at the DB level.
- Comment component:
- Pinned comments render ahead of everything else; reorder()
clears the comments() relation's default ->latest() so pinned
DESC becomes the PRIMARY sort instead of a tiebreaker.
- Creator sees heart + pin toggle buttons in the action bar.
- Hearted comments carry a small red heart badge in the meta row.
- Pinned comments carry a "Pinned by {creator}" header and a
red left accent so they're visually distinct from the stream.
## Tests (9 new, 63 total)
- Dislike toggle adds/removes the row.
- Disliking clears an existing like and vice versa.
- Owner can heart; non-owner gets 403.
- Only one comment pinned at a time; replies can't be pinned (422);
non-owner gets 403.
- Pinned comments render before newer unpinned ones.
## Deploy note
Running the migrations against the live DB needs:
php artisan migrate
The two migration files are additive and reversible via `migrate:rollback`.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Four tests covering the post-audit polish commits:
- Match watch page renders the shared .channel-row component.
- Reply-to-reply button carries data-parent-id and data-handle so the
JS can prefill "@author " when the parent reply form opens.
- liked() controller returns a CursorPaginator instance (controller
introspection — avoids a 400 KB view render per assertion).
- video-player component ships the ">" / "<" playback-rate hotkey.
Also cleans up a stale ->onEachSide()->links() call in user/liked.blade
that would blow up now that the controller returns a CursorPaginator
(which doesn't support onEachSide).
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- /liked: switch Laravel paginate(12) to cursorPaginate(24). Cursor
pagination matches the Phase 2 feed endpoint pattern: stable across
inserts (unlike ?page=N which can duplicate or skip rows when a new
like lands between page fetches) and loads a bounded slice no matter
how many thousands of likes the user accumulates.
- /history: switch from a get()-all plus in-memory sort to a joined
simplePaginate(48) at the DB layer. A heavy user who's watched
thousands of videos would previously fetch every video row into
memory on each history page load — now the query selects a bounded
page of (video_views + videos) pairs. Duplicates within a page
collapse via collect()->unique('id').
Channel videos tab stays non-paginated for now — it needs a dedicated
JSON endpoint before it can share the Phase 2 /videos/feed/more
infinite-scroll wiring. Flagged as follow-up.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
YouTube-parity hotkeys. Shift+. (">") steps playback up by 0.25 to a
max of 2x; Shift+, ("<") steps it down to a min of 0.25x. "." / ","
alone also work when the browser doesn't surface Shift for the
underlying character — e.g. non-US keyboard layouts.
Theater (T), PiP (I), Fullscreen (F), Play/pause (K / space), Mute
(M), Seek (J / L / arrows), % seek (0-9) were already wired — this
closes the remaining Phase 4 hotkey gap.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Match page: the only path from a match video to the uploader's channel
was a tiny avatar buried inside the Match Overview card. Add the shared
<x-channel-row :video> component right under the title + action bar so
the Subscribe + channel link is as prominent as it is on music and
generic pages.
Comments:
- Long comments collapse to a 4-line clamp with a "Read more" / "Show
less" toggle. The CSS line-clamp doesn't cut mid-word, and the
button is added after enhanceBody() runs so it measures the final
rendered height (timestamps + mentions already materialised).
- Nested-reply Reply button: each reply now carries a button that
opens the parent-level reply form and prefills "@AuthorName " so
the thread stays readable even though the DB only stores one-level
nesting.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Four tests covering the admin polish follow-ups to Phase 7:
- Pagination partial renders both First and Last anchors with the
correct aria-labels and page URLs on a middle-page view.
- Pagination partial degrades to a disabled First span on page 1 so
the admin can't click into an invalid negative page.
- Admin video list strips HTML tags from the description preview
(no "<p>Hello" leaking into the row) and carries the full
title in a title="" tooltip on the ellipsized columns.
- Dashboard stat card now shows "Ready" instead of the misleading
"Live Videos" label the Phase 7 commit renamed.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Storage:
- The dashboard storage card used to walk Storage::disk('public')'s
videos / thumbnails / avatars / images directories. NAS is primary
storage, so for every file that's been pushed-and-purged (most of
them, per CLAUDE.md), the disk walk reports 0. Replace with a
DB-driven estimate: SUM(videos.size) for video bytes plus a 120 KB
conservative per-file estimate × (thumbnails + avatars + banners +
post images). Fast (3 count queries + one SUM), works regardless
of local-cache state, and now reflects content that lives on NAS.
Error logs:
- Flat view used to render every line as its own equal-weight <div>,
so a stack trace of 70 frames buried the next real event. Group
lines by header: a line that matches .(ERROR|WARNING|INFO|DEBUG|
CRITICAL|…): starts a new group; subsequent lines belong to its
stack trace. Each group collapses by default behind a caret the
admin can expand. Stack-trace lines preserve their natural #0 → #N
order inside the group even when the file is reversed newest-first.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- Admin video list: description was stored as sanitized rich HTML, so
the admin's "{{ Str::limit(description, 55) }}" row printed literal
<p>…</p> tags in the preview. Pre-strip the HTML, collapse
whitespace, and surface the full stripped text in a title=""
tooltip. The visible title column now also carries title="" so the
admin can hover an ellipsized name to read it in full.
- Shared pagination partial (used by admin videos + users + feed
pagers) now ships First + Last buttons. The icons use the double-
chevron variants and the aria-label makes the destination explicit.
Buttons disable cleanly on page 1 and the last page.
- Audit-logs pager has the same four buttons: First, Prev, N…N, Next,
Last. Each disabled state carries a title tooltip so the admin
knows what each stub does without hovering through trial and error.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
PHPUnit was flagging 18-19 tests per run as "did not close its own
output buffers". The leaks come from Blade — a @once block, a @push,
or a view that throws mid-render leaves ob_start()'ed buffers open
when the test method returns.
Capture ob_get_level() in setUp, then unwind back to that depth in
tearDown. Suite is now green AND clean: 46/46, 0 failures, 0 risky.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
ExampleTest hit GET / expecting 200, but had no RefreshDatabase trait,
so the home controller's Video::public()->pluck('id') query hit a
non-existent `videos` table in the testing DB and 500'd. It's been
failing since Phase 1 but was always flagged as "pre-existing,
unrelated" because the test file isn't touched by any audit code.
Now mirrors the Phase-test setup: putenv forces :memory: before
parent::setUp, RefreshDatabase migrates the throwaway DB, and the
assertion passes against an empty home feed. 46/46 green.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Six tests covering:
- Skip-to-content link renders on the home page with href="#main".
- Hamburger menu + mobile search toggle buttons carry aria-label
attributes (regression test for icon-only buttons losing their
accessible name).
- Registration is server-side rejected with a birthday error when
the user is under 13; a 14-year-old passes.
- Gender select on channel settings uses "Select…" for the empty
value instead of a second "Prefer not to say".
- Unknown URL returns 404 with the branded body ("Error 404").
The <title> format test for the 404 page is captured in the deploy
checklist instead of here because the exception handler in the
testing env bypasses layouts.app's head and makes the DOM-level
<title> assertion unreliable; curl -I against /no-such on the live
site confirms "Page not found | TAKEONE".
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
A11y:
- Skip-to-content link lands first in the body and jumps to #main
past the header + sidebar for keyboard users.
- aria-label on the icon buttons that previously carried only an
icon: hamburger menu (+ aria-controls="sidebar"), mobile search
toggle, account menu (also drops the duplicate alt on the avatar
since the button name already speaks the user's name).
Admin:
- Dashboard stat card renamed "Live Videos" → "Ready" (matches the
DB status column; nothing on this card is actually live).
Settings:
- Duplicate "Prefer not to say" option on the Gender select — the
empty placeholder shared the same label as the real option.
Placeholder is now "Select…"; the real "Prefer not to say" option
stays unchanged.
- Birthday picker caps the Year dropdown at (this year − 13) and
the server-side register validation requires the same, so a
client bypass can't let a <13 user through.
Titles:
- Admin layout uses "{Page} | TAKEONE" to match the frontend format
(was "{Page} — TAKEONE"). User pages that said "| TAKEONE" literal
now interpolate config('app.name'). Shorts and Welcome moved from
" - " to " | " separator.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Also tightens stat/post-video rendering so "0" prints as "0" and not
"0.0" (Number::abbreviate(0, precision: 1) stringifies as "0.0", which
leaked into the About tab's Total Views card and post-video badges).
Four tests covering:
- /@username opens the matching channel.
- /@invalid url (space) 404s.
- Owner view shows id="postForm"; preview?preview=1 hides it.
- Zero-view playlist doesn't render "bi-eye … 0.0"; "1 videos" never
renders in place of "1 video".
Fixed a Blade dupe-declaration fatal that only fired in feature tests
(two requests in one PHP process would redeclare notifVal()). Guarded
with function_exists.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- New /@handle route (channel.handle name) that maps to UserController@channel,
so YouTube-style profile URLs work. Handle is the existing username
slug for now; a dedicated `handle` column can land later if we want
the two to diverge. {handle} is constrained to [A-Za-z0-9][A-Za-z0-9._-]*
so arbitrary paths don't match this route.
- Composer on the Wall tab used Auth::id() === $user->id directly,
which bypassed the $isOwner flip-to-false that preview-as-visitor
does. The composer now also checks !$preview so previewing an
owner's channel hides the post box as a visitor would see it.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- Playlist cards on the channel page used Number::abbreviate for the
view count, which prints "0.0" (precision=1) when the playlist has
never been viewed. Hide the whole view-count row for zero-view
playlists; still show "1.2K" / "2.3M" when there's traffic.
- "N videos" counts (header meta row + per-playlist count) now use
Str::plural so "1 video" renders correctly instead of "1 videos".
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Five tests:
- /shorts/{id} renders the vertical feed with data-id matching the
target short and includes the scrollIntoView bootstrap.
- /shorts/{id} 404s when the id resolves to a non-short video.
- Home page shows .home-shorts-shelf when at least one short exists,
with a link to /shorts/{id} for every shelf card.
- Home page omits the shelf entirely when no shorts exist.
- An unknown URL returns 404 with the branded view, not the bare
framework stacktrace.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Any URL that doesn't resolve to a known route or model now renders a
page that matches the app shell: header, sidebar, dark theme. The
page explains what happened in one sentence and offers three next-
step buttons — Home, Browse Videos, Watch Shorts. Previously /shorts/1
(and every other unknown URL) rendered the bare framework 404 with no
header, no navigation and no theme.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The home grid used to interleave shorts with regular videos ordered by
upload date, so a cluster of 60-second portrait clips could fill the
first row and push the non-shorts off the fold. Split them:
- The main feed grid now excludes shorts (notShorts() filter).
- A horizontally-scrolling Shorts shelf renders above the grid with
up to 12 latest shorts, each a real <a href> to /shorts/{id} so
tapping it deep-links the vertical feed to that short.
- "See all" link in the shelf header jumps to the full /shorts feed.
- Shelf is skipped entirely when there are no shorts to show.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- New route /shorts/{video} opens the feed scrolled to that short.
Controller aborts 404 when the id doesn't resolve to a short or
isn't viewable by the current viewer, so bad links land on the
branded 404 (added in the next commit) rather than loading an
empty feed.
- The IntersectionObserver that detects the active short now
history.replaceState()s the URL to /shorts/{id} so copy-paste of
the address bar works, without pushing a navigation entry — the
back button still exits the feed in one step.
- Mute state is persisted in localStorage (shortsMuted = '0' | '1')
so unmuting once sticks across sessions. Default remains muted
to satisfy autoplay policies on first load.
- Mouse-wheel navigation moves one short per gesture with a 450 ms
debounce. Trackpad flicks no longer skip five shorts at once.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- All three type-specific watch templates (generic / music / match)
were still rendering the Up Next list as <div onclick="recGoTo(...)">
— only show.blade.php had been converted in the earlier commit.
Convert each to <a href> so middle-click / right-click / cmd-click
open-in-new-tab work, keeping the SPA swap on normal left-click via
an onclick guard that lets modified clicks fall through.
- 9 feature tests covering: singular/plural comment counts, top-level
vs reply separation, ?lc= permalink HREFs, markdown header
promotion in HtmlSanitizer::render(), passthrough of plain text,
download access gate for both MP4 and MP3 at disabled + registered
tiers, and sidebar anchor-card presence.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
AI-generated descriptions ("Letra" / "Chorus" / "Translation") landed
in the DB with markdown prefixes that the sanitiser treated as plain
text — so viewers saw literal "## Letra" and "### Chorus" instead of
headings.
HtmlSanitizer::render() now promotes `##` / `###` at the start of a
line into <h2>/<h3> before sanitising, so the existing allowlist
accepts them and the reader sees real headings. Only touches lines
whose entire content is a heading — markdown mid-sentence is left
alone to avoid false positives.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
A video with two audio tracks sharing the same language (common when
an upload was retried before the first attempt finished syncing) used
to show both rows in the player's language picker, leaving the viewer
guessing which one to pick. Dedupe keeps the first occurrence per
(language, label) pair — so legit variants like "en — Original" and
"en — Director's cut" still coexist, but bare duplicates collapse.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- Header count now reads "N Comments · M replies" with correct
pluralisation ("1 Comment", "1 reply" — never "1 Comments"). The
old "N comments" number silently folded replies into the main
figure, overstating conversation depth.
- Every timestamp is a permalink. href="?lc=<id>#comment-<id>" lands
on the exact comment or reply when opened — the init handler
auto-expands the parent thread for nested replies, scrolls the
target into view, and pulses a soft red highlight for 2.8s so the
reader sees where they landed.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- VideoController@show now scores the newest 200 public ready videos
against the one being watched: +4 same type, +3 same language, +2
any tag overlap, +1 same channel. Sort by score desc then by newest.
Replaces the plain "latest 20 excluding self" list that was often
dominated by whatever happened to be uploaded last, with no regard
to what the viewer actually chose.
- Sidebar cards are real <a href> elements again, so middle-click,
right-click, cmd-click and screen readers all work. The SPA click
interceptors in types/{music,generic}.blade.php still fire via
data-rec-url for a soft-swap when the user left-clicks normally.
- loading="lazy" + width/height on the sidebar thumbnails so a long
Up Next list doesn't blow the critical path.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@json() with a multi-line arrow function whose body is an array literal
confuses Blade's directive parser — it reads the inner '[' as an
unmatched bracket and bails out with "Unclosed '[' on line 744 does
not match ')'". Precompute the array in a plain @php block and hand
the already-evaluated collection to @json() instead.
The bug has been dormant because the compiled view was cached. It
surfaced the moment the view cache got cleared.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Six feature tests:
- Trending accepts hours=24|168|720, snaps garbage input to 24.
- Trending ranks by in-window views then likes; videos with zero
in-window views are dropped.
- Music feed opens on the newest video (regression test for the
skipped-->latest() call in VideoController@index).
- Old /videos/search?q=... returns a 301 to /search?q=...
- /search matches on video title, channel name, and playlist name
separately; each surfaces in its own Section.
- Empty /search?q= redirects to /videos browse.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Add a dedicated SearchController that matches the query against video
title / description / tags / primary language AND any secondary audio
track language (so "arabic" surfaces videos that carry an Arabic track
even if the primary language is English), plus channel name / username
/ bio, plus playlist name / description. Public visibility only.
Results reuse the videos/index view so every card gets the same
component the browse feeds use. A new Channels section renders above
the Videos grid when channel hits exist.
/videos/search is kept as a 301 redirect to /search so bookmarks and
external links stay valid; both the desktop header and mobile overlay
search forms now point at the canonical route, both carry a visually
hidden <label>, both get role="search" and both preserve the current
query in their input.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- 'New to You' promised personalised recommendations the chip did not
deliver — it was simply filter=latest, the newest videos regardless
of viewer. Renamed to 'Recent' so the label matches the behaviour.
- Every active chip now carries aria-current='page' so a screen reader
knows which filter is live without having to infer from the visual
'active' class. role='navigation' + aria-label on the bar.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The main match scoreboard overlay used to render the literal strings
"CLUB LOGO" and "FLAG" inside the per-corner slots whenever the match
had no club logo or flag assigned yet. The slots were there as a visual
design cue, but the text was leaking into cards (via the mini scorebar
overlay that already got removed in Phase 2) and showing up on the
scoreboard itself while a match was being set up.
Both slots are now empty by default. The script.blade.php logic that
replaces them with a real <img> or SVG background on load is unchanged
— when real data is present the output is identical. aria-hidden on
the empty boxes so a screen reader doesn't announce the gap.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- Trending: window options are now 24 / 168 / 720 h (Today / This Week
/ This Month) and the controller snaps the ?hours param to one of
those values instead of clamping to [24, 168] — which silently made
the "This Month" tab show one-week data. Ranking is pure in-window
view count, with likes and newest createdAt as the tiebreaks (not
the old weighted sum of views + velocity + recency bonus + likes,
which was impossible to reason about and hid videos that genuinely
led the window).
- Music + /videos?filter=music: previously the branch skipped the
latest() call so Eloquent fell back to id ASC and the music tab
opened on the oldest uploads. Now both branches share one
->latest() call.
- Channel Popular sort: order by views desc, likes desc, created_at
desc so two equally-viewed videos no longer flip order between
loads.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Audit fixes against /channel/{slug}:
1. Fluid video grid — repeat(auto-fill, minmax(260px, 1fr)) replaces
the three fixed breakpoints (3/2/4 cols at 1101/1500/… px) that
produced different card widths and could overflow 390 / 1280 /
1920. min-width:0 on every grid child so a long unbroken title
(CJK, "SPARTAWORRIOR") can't widen its track past 1fr.
2. Scoreboard thumbnail — stop including vs-mini + scorebar-mini on
match cards. Those partials leaked fighter names, "AKA/AO",
"ROUND 1", "0:00" into the card DOM, showing stale 0-0 for
finished matches and breaking title layout at narrow widths. The
regular <img> above is the thumbnail now; VS intro + live scorebar
still render on the full match player page where they belong.
3. Sort pills — Latest/Popular/Oldest now append #videos so the page
stays on the Videos tab after reload instead of jumping to Wall.
4. Shorts tab — always render for the owner (so the "My Shorts"
sidebar link always lands somewhere), with an empty-state card
when no shorts exist. Visitors still see it only when shorts > 0.
5. Subscriptions sidebar link — href="#" replaced by a real
/feed/subscriptions route backed by UserController@subscriptionsFeed
that reuses the videos/index view with the subscription feed.
6. Header view count — totalViews now sums video_views over public
videos for visitors (owner still sees the full total). Previously
leaked unlisted and private video view counts.
7. Card redundancy — new hideChannelInfo prop on <x-video-card/>
suppresses the per-card avatar + channel-name row. The channel
page passes it; everywhere else keeps the row.
9. Decorative logo — the second <img alt="Play"> in the responsive
header pair now has alt="" so a screen reader doesn't announce
"Play Play". ⋮ menu button gets aria-label="More actions".
10. Privacy — age, gender, location and horoscope strip now only
render to the owner on the channel header (horoscope strip is
also allowed when the compatibility match-up is being shown to
a signed-in visitor). Joined-month stays public.
11. Notifications dropdown — initial state is "No notifications"
not an indefinite "Loading…". Opening the panel now shows a
spinner while fetching, surfaces a Retry button on error, and
bails out of the "Loading…" state on non-ok HTTP responses.
Title clamp — .yt-video-title is now a 2-line box with
overflow-wrap:anywhere so CJK titles and long words wrap mid-word
and can't widen the card past its track.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Context: on 2026-10-21 the dev SQLite DB was wiped because an early
revision of Phase 1 tests called RefreshDatabase before the per-test
config() swap had been applied, so migrate:fresh ran against the real
database file. Restored from data/backups/db-20261020-033001.sqlite
(24 users, 72 videos, 32 comments recovered); anything created between
Oct 20 03:30 and Oct 21 08:25 needs manual rebuild from NAS.
Two layers of defense added so this cannot recur:
1. .env.testing — forces DB_CONNECTION=sqlite and DB_DATABASE=:memory:
at the earliest bootstrap stage, before any trait setUp hook runs.
Also carries the APP_KEY and testing-safe defaults for mail/queue
/session.
2. TestCase::assertSafeTestDatabase() — a belt-and-braces guard that
aborts the whole phpunit run (exit code 2) if the resolved default
DB target is anything other than :memory: or a /testing/ or /tmp/
path. The abort happens BEFORE any query can execute.
Running the suite with a bad DB target now prints a stderr banner and
stops instantly; the dev file is safe even if someone writes a new
test that forgets to override the connection.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Seven feature tests covering:
- the per-card edit modal is gone (id="editVideoModal{slug}" and the
.cute-edit-modal class),
- owner sees Edit/Delete and no Report/Not-interested,
- non-owner sees Report/Not-interested and no Edit/Delete,
- card thumbnail img carries width/height and loading="lazy",
- feedMore returns JSON with items + next_cursor + has_more,
- feedMore rejects unknown filters by returning an empty slice,
- comments component ships the reply <template>, not inline forms.
While wiring these up I also deleted the 300-line .cute-edit-modal CSS
block that was still shipping in card-styles.blade.php even though its
markup was removed in the previous commit — the CSS was pointing at
IDs that no longer exist.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The reply form used to render ~13 lines of hidden markup under every
top-level comment, so a 50-comment video shipped roughly 650 lines of
inert DOM to every signed-in viewer. Replaced with a single
<template id="ytc-reply-form-tpl"> plus a per-comment slot div; the
first click on Reply clones the template, wires the IDs
(replyForm{id}, replyBody{id}, data-parent-id, data-video-id) and
appends it, so toggle behavior stays identical from the user's side.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Add VideoController@feedMore -> JSON { items, next_cursor, has_more }
that pages the current filter (all / shorts / match / music / lang:xx)
with Laravel's cursorPaginate(24). Cursor is stable across inserts, so
scrolling never duplicates or skips a video when something is uploaded
mid-session.
Client side: a #feed-sentinel + IntersectionObserver (rootMargin
400px) appends the next page of cards to the existing grid without a
page reload. A Load More button is always wired as the fallback when
IO is unavailable or a fetch fails. Both reuse the existing
<x-video-card/> component, so the newly fetched cards get the same
singleton edit modal + width/height thumbs as the server-rendered ones.
The initial 60-card server render stays, so the first viewport is
unchanged. The limit(60) and limit(50) caps in index() can now be
treated as "first page size" rather than a hard ceiling.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- Delete the per-card "cute" edit modal (lines 242-341) and the three
dead handlers that drove it (openEditVideoModal, closeEditVideoModal,
the type/privacy/thumbnail/submit document-level delegators). The
singleton at layouts/partials/edit-video-modal.blade.php already
defines a global window.openEditVideoModal that always won the
last-definition race, so clicking Edit was already going through
the singleton. Card is 547 -> 308 lines; a 60-card feed drops
~14 000 lines of modal markup.
- "Not interested", "Don't recommend channel", "Report" are now gated
on @unless($isOwner) — they're meaningless on your own video.
- All dropdown items that were <a href="javascript:void(0)" onclick>
are now real <button type="button">, including the save-to-playlist
and share slots (tag="button").
- Thumbnail img gains width="320" height="180" so the browser reserves
layout space before the image decodes — removes layout shift on
slow connections. The actual rendered size still comes from
.yt-video-thumb's aspect-ratio: 16/9.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Seven feature tests, run against an in-memory SQLite forced via putenv
in setUp (keeps the shared dev DB safe). Covers:
- Reserved-identifier rule rejects admin / super_admin / takeone /
support / etc, matches both name and email local-part only, and
lets normal names through.
- SafeNotifier swallows a notification throw without re-raising.
- Identical comments within 60s collapse to the first row.
- X-Idempotency-Key returns the first comment on retry.
- Owner viewing their own video does not insert a video_views row.
AppServiceProvider stops force-upgrading the scheme in the testing env
so the HTTP test client isn't 302'd before reaching the controller.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- Insert is skipped entirely when the authenticated viewer owns the
video. Owners re-watching, previewing an edit, or impersonating no
longer inflate their own view counts.
- Dedupe window drops 1h -> 30min for both auth and guest paths.
- Auth-path dedupe now also matches on device fingerprint / device_id
cookie, so signing out and back in during the same session doesn't
double-count a single viewer.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>