feat: add 'Enable for Login' toggle for Jellyfin#248
Conversation
|
Claude finished @mchestr's task in 1m 15s —— View job PR Review - Latest Changes Verified ✅Todo List
SummaryI've reviewed the latest changes since my last approval. This PR remains in excellent condition and is ready to merge. Latest Commits ReviewCommit
|
Code Review SummaryI've completed a thorough review of this PR. Overall, this is a well-implemented feature that follows project conventions. ✅ Strengths
|
Updated PR Review - All Feedback Addressed! ✅I've reviewed the latest changes and I'm pleased to report that all of my previous feedback has been addressed. This PR is now in excellent shape. What Was Fixed✅ 1. Zod Validation Added (MEDIUM Priority - RESOLVED)Location: The const toggleJellyfinLoginSchema = z.boolean()
export async function toggleJellyfinLogin(enabled: boolean) {
await requireAdmin()
const validated = toggleJellyfinLoginSchema.safeParse(enabled)
if (!validated.success) {
return { success: false, error: "Invalid input: enabled must be a boolean" }
}
// ... rest of implementation
}Why this is good: Follows CLAUDE.md requirement for "Zod validation for all inputs" and provides runtime safety. ✅ 2. Comprehensive Unit Tests Added (HIGH Priority - RESOLVED)Location: Excellent test coverage with 7 test cases covering:
Test quality observations:
✅ 3. E2E Test Added (HIGH Priority - RESOLVED)Location: New E2E test verifies the toggle functionality: test('should toggle Jellyfin login visibility in settings', async ({ adminPage }) => {
// Navigate to settings
await adminPage.locator('aside').getByTestId('admin-nav-settings').first().click();
// Test toggle if Jellyfin is configured
const jellyfinToggle = adminPage.getByTestId('jellyfin-login-toggle');
if (await jellyfinToggle.isVisible({ timeout: 5000 }).catch(() => false)) {
// Toggle and verify state changes
const buttonText = await jellyfinToggle.textContent();
await jellyfinToggle.click();
await expect(jellyfinToggle).not.toHaveText(buttonText!);
// Toggle back and verify
await jellyfinToggle.click();
await expect(jellyfinToggle).toHaveText(buttonText!);
}
});Why this is good:
Remaining Observations (Minor - Not Blockers)1. Button Component Usage (LOW Priority)Location: The toggle button uses custom Tailwind classes instead of the UI component library <button
onClick={handleToggle}
disabled={isPending}
data-testid="jellyfin-login-toggle"
className="px-3 py-1 bg-slate-800/50 hover:bg-slate-700/50 ..."
>CLAUDE.md states: "Always use existing UI components" from However, this is acceptable because:
No action required - this is fine as-is. 2. Transaction Usage (LOW Priority)Location: The function uses await prisma.jellyfinServer.updateMany({
where: { isActive: true },
data: { enabledForLogin: validated.data },
})Why this is acceptable:
No action required - this is fine as-is. Security Review ✅
Code Quality ✅
Test Coverage ✅
Final Verdict: ✅ APPROVEDThis PR is ready to merge. All critical feedback has been addressed:
The remaining observations are minor preferences that don't impact functionality or maintainability. Great work addressing all the feedback! 🎉 |
Add ability to hide Jellyfin from the login page via admin settings. When disabled, Jellyfin won't appear as a login option for anyone. Changes: - Add enabledForLogin field to JellyfinServer model (default: true) - Add toggleJellyfinLogin server action - Add JellyfinLoginToggle component in admin settings - Update home page query to check enabledForLogin
- Add Zod validation to toggleJellyfinLogin server action - Add unit tests for toggleJellyfinLogin action - Add E2E test for Jellyfin login toggle in admin settings
The E2E tests were failing because the migration for the new enabledForLogin field on JellyfinServer was missing. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
176d8a6 to
416627a
Compare
Summary
Changes
enabledForLoginfield to JellyfinServer model (default: true)toggleJellyfinLoginserver action in admin-servers.tsJellyfinLoginTogglecomponent shown below Jellyfin server configenabledForLogin: trueTest plan