Skip to content

Conversation

@worldInColors
Copy link
Contributor

@worldInColors worldInColors commented Dec 25, 2025

Summary by CodeRabbit

  • New Features

    • Added support for custom NNTP server configuration in template inputs.
    • UI shows a dedicated input for custom NNTP servers while keeping existing behaviour for other input types.
  • Bug Fixes / Improvements

    • Improved template migration: selected services are enabled (created if missing) and unselected services disabled.
    • Custom NNTP server values are initialised and correctly propagated during template load.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 25, 2025

Walkthrough

Template input handling now recognises a new 'custom-nntp-servers' input type. The modal imports and renders NNTPServersInput, credential filtering and input initialisation were extended to include this type, and template migration now explicitly enables selected services and disables unselected ones. NNTPServersInput and its props are exported.

Changes

Cohort / File(s) Summary
NNTP server input & template modal
packages/frontend/src/components/shared/config-templates-modal.tsx
Added 'custom-nntp-servers' to TemplateInput.type. Imported and render NNTPServersInput for that type; extended credential filtering to include custom-nntp-servers; initialised/propagated values for the new input type; integrated enable/disable selected-services logic into template migration and userData save; hide descriptions for custom-NNTP inputs.
Public exports for NNTP input
packages/frontend/src/components/shared/template-option.tsx
Exported NNTPServersInputProps and NNTPServersInput to allow reuse. No control-flow changes beyond export visibility.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped through code with a curious song,
NNTP rows now line up strong,
Inputs wired and services set,
Templates swap with no regret,
A tiny hop — a tidy change ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: enable Stremio NNTP service during template import' accurately describes the main change, which involves reworking service enabling/disabling logic during template load/import to enable selected services.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/frontend/src/components/shared/config-templates-modal.tsx (1)

973-978: Use strict equality operators.

The filter uses loose equality (==) instead of strict equality (===). While this works, strict equality is preferred for type safety and consistency with TypeScript best practices.

🔎 Proposed fix
       serviceMeta.credentials
         .filter(
           (cred) =>
-            cred.type == 'string' ||
-            cred.type == 'password' ||
-            cred.type == 'custom-nntp-servers'
+            cred.type === 'string' ||
+            cred.type === 'password' ||
+            cred.type === 'custom-nntp-servers'
         )
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ae8d917 and 41fbe70.

📒 Files selected for processing (2)
  • packages/frontend/src/components/shared/config-templates-modal.tsx
  • packages/frontend/src/components/shared/template-option.tsx
🧰 Additional context used
🧬 Code graph analysis (1)
packages/frontend/src/components/shared/config-templates-modal.tsx (1)
packages/frontend/src/components/shared/template-option.tsx (1)
  • NNTPServersInput (447-666)
🔇 Additional comments (6)
packages/frontend/src/components/shared/template-option.tsx (1)

439-447: LGTM! Exports enable proper consumption.

The interface and component exports are correct and enable the NNTPServersInput to be consumed by the config-templates-modal component.

packages/frontend/src/components/shared/config-templates-modal.tsx (5)

31-31: LGTM! Import is correct.

The import statement correctly references the newly exported component.


77-77: LGTM! Type extension is appropriate.

The addition of 'custom-nntp-servers' to the TemplateInput type union correctly supports the new input type.


985-988: LGTM! Type mapping is correct.

The ternary operator correctly maps 'custom-nntp-servers' credentials to the corresponding input type, while treating other credential types as password inputs for security.


1747-1758: LGTM! Component rendering is correct.

The NNTPServersInput component is properly rendered with the correct props, and the state management for the input value is handled appropriately.


1762-1767: LGTM! Conditional rendering avoids duplication.

Skipping the description for 'custom-nntp-servers' is correct since the NNTPServersInput component handles its own description rendering internally.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/frontend/src/components/shared/config-templates-modal.tsx (1)

973-978: Consider using strict equality (===) instead of loose equality (==).

The filter logic correctly includes the new custom-nntp-servers type. However, using == instead of === is inconsistent with TypeScript best practices, even though it's functionally equivalent when comparing string literals.

🔎 Proposed fix
       serviceMeta.credentials
         .filter(
           (cred) =>
-            cred.type == 'string' ||
-            cred.type == 'password' ||
-            cred.type == 'custom-nntp-servers'
+            cred.type === 'string' ||
+            cred.type === 'password' ||
+            cred.type === 'custom-nntp-servers'
         )
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 41fbe70 and f29abcf.

📒 Files selected for processing (1)
  • packages/frontend/src/components/shared/config-templates-modal.tsx
🧰 Additional context used
🧬 Code graph analysis (1)
packages/frontend/src/components/shared/config-templates-modal.tsx (2)
packages/frontend/src/components/shared/template-option.tsx (1)
  • NNTPServersInput (447-666)
packages/frontend/src/components/ui/password-input/password-input.tsx (1)
  • PasswordInput (40-146)
🔇 Additional comments (5)
packages/frontend/src/components/shared/config-templates-modal.tsx (5)

31-31: LGTM!

Import correctly brings in the NNTPServersInput component needed for the new custom NNTP servers input type.


77-77: LGTM!

Type union correctly extended to support the new NNTP servers input type.


1194-1221: Good improvement: services are now disabled instead of removed.

This change correctly addresses the previous concern about data loss. Pre-configured services in the template are now preserved with their settings, and unselected services are simply disabled rather than removed.

Minor type safety note: Line 1207 uses as any type assertion which bypasses type checking. Consider using the proper service ID type if available.

🔎 Optional: remove type assertion if service types are available
           services.push({
-              id: serviceId as any,
+              id: serviceId,
               enabled: true,
               credentials: {},
             });

If the service array expects a specific union type for id, you may need to properly type selectedServices or use a type guard instead of as any.


1750-1761: LGTM!

The NNTPServersInput component is correctly integrated with proper prop wiring. The component handles its own description rendering internally, justifying the conditional description logic below.

Note: The disabled prop is available on NNTPServersInput but not passed here. This is acceptable if the input should never be disabled in this context, but consider adding it if disabling is needed during loading states.


1765-1770: LGTM!

Correctly excludes description rendering for custom-nntp-servers inputs since the NNTPServersInput component renders its own description internally.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/frontend/src/components/shared/config-templates-modal.tsx (1)

973-978: Consider using strict equality operators.

The filter uses loose equality (==) instead of strict equality (===). While functionally equivalent for string comparisons, strict equality is the recommended practice in TypeScript/JavaScript to avoid unexpected type coercion.

🔎 Suggested fix
       serviceMeta.credentials
         .filter(
           (cred) =>
-            cred.type == 'string' ||
-            cred.type == 'password' ||
-            cred.type == 'custom-nntp-servers'
+            cred.type === 'string' ||
+            cred.type === 'password' ||
+            cred.type === 'custom-nntp-servers'
         )
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f29abcf and 3b961d4.

📒 Files selected for processing (1)
  • packages/frontend/src/components/shared/config-templates-modal.tsx
🔇 Additional comments (6)
packages/frontend/src/components/shared/config-templates-modal.tsx (6)

31-31: LGTM!

The import is correctly added and the component is properly used later in the rendering logic.


77-77: LGTM!

The type union correctly includes the new 'custom-nntp-servers' input type.


985-990: LGTM!

The type mapping correctly preserves the original credential types: 'custom-nntp-servers' maps to itself, 'password' maps to 'password', and all other types (including 'string') correctly default to 'string'.


1196-1223: Good fix addressing the previous review concern.

The logic now correctly:

  1. Enables selected services (creating them if missing)
  2. Disables unselected services instead of removing them

This preserves pre-configured service settings and credentials, preventing data loss that was flagged in the previous review.


1752-1763: LGTM!

The NNTPServersInput component is correctly integrated with appropriate props and state handling.


1767-1772: LGTM!

Correctly suppresses the external description rendering for 'custom-nntp-servers' inputs since the NNTPServersInput component handles its own description display internally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant