Teach this on backtoschool.help: a class title that fits, walked up from the lecture to its collection - #219
Merged
Merged
Conversation
…rom the lecture to its collection A folder channel names its entry by the whole served path, and a course is deep (collection / part / week / lecture), so the one-click class from a live room sent a title past the school's 160 and got "title is too long". classTitle() in web/src/live-context.ts keeps the lecture (cleaned by liveTitle) and the outermost folder, fills the folders between back in from the lecture upward while they fit, and as a last resort cuts the collection at a word so what is playing is never the part that is lost. A title with no path in it is cut at a word. Titles that already fit are left alone. The school's own form has maxlength=160, so this was the only sender of an oversize title. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What broke
Clicking Teach this on backtoschool.help while a folder channel was live failed with:
A folder channel names its entry by the whole served path, and a course is deep (
Coursera - Deep Learning Specialization/1. Neural Networks.../Week 1.../03_what-is-a-neural-network.mp4), so the title ran past the school's 160-character limit inlive-events.ts. The school's own form already hasmaxlength="160", so the one-click flow was the only sender of an oversize title.What changed
classTitle()inweb/src/live-context.tstrims a title that does not fit by walking up from the file:liveTitle, so03_what-is-a-neural-network.mp4becomeswhat-is-a-neural-network) and the outermost folder (the collection) are always keptExample at 160:
Coursera - Deep Learning Specialization › Neural Networks and Deep Learning Basics › what-is-a-neural-network-and-how-does-it-learnteachOnSchool()inweb/src/app.tspasses the share title through it before POSTing the class.Verified
bun test web/test: 109 pass (2 new tests forclassTitle)webtypecheck clean🤖 Generated with Claude Code