feat(PlexImportModal): add user details sync functionality#2977
feat(PlexImportModal): add user details sync functionality#2977
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughTreats an empty Changes
Sequence Diagram(s)sequenceDiagram
participant User as User
participant Modal as PlexImportModal
participant API as PlexImportAPI
participant Toast as ToastService
User->>Modal: Click "Import"/"Sync"
Modal->>API: call import endpoint
API-->>Modal: return { createdUsers: [...] } or []
alt createdUsers is array with length > 0
Modal->>Toast: show import-success toast + missing-password warning (if any)
else createdUsers is empty array (sync-only)
Modal->>Toast: show "Plex users synced successfully" toast
else createdUsers is not array
Modal->>User: surface error / throw
end
Modal-->>User: update OK button label/state and show empty-state `syncnotice` if applicable
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/components/UserList/PlexImportModal.tsx`:
- Around line 62-92: The code currently treats createdUsers.length === 0 as a
successful sync and shows messages.importfromplexsynced; instead change the
logic to rely on an explicit success indicator returned by the API (e.g.,
response.syncedCount, response.refreshedUsers, or response.importResult.status)
rather than an empty array. In PlexImportModal, inspect the response object for
a dedicated "synced" or "refreshed" field (or a numeric syncedCount) and only
show messages.importfromplexsynced when that explicit field indicates work was
performed; if no explicit indicator exists, show a neutral/info toast (or no
success toast) indicating nothing was created/refreshed and log the full
response for debugging. Update usage sites around createdUsers, addToast, and
the success/empty-branch logic accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 34084fdb-24c9-4dde-bbd2-bf3cd1106874
📒 Files selected for processing (3)
src/components/UserList/PlexImportModal.tsxsrc/i18n/globalMessages.tssrc/i18n/locale/en.json
|
Possible remaining edge case after commit In That means an import-mode POST returning CodeRabbit’s earlier comment correctly flagged the old empty-array sync toast as misleading in import mode. The follow-up commit removed that misleading success toast, but I think the import-mode empty-array case may still need an error/info toast so the modal does not close silently. |
Description
This PR improves the Plex user import flow by allowing it to act as a sync when no new users are available.
This avoids the previous dead-end where admins couldn't do anything if no new users were found, even when they just needed to refresh existing ones.
How Has This Been Tested?
Did the same for the email address
Screenshots / Logs (if applicable)
Checklist:
pnpm buildpnpm i18n:extractSummary by CodeRabbit
New Features
Improvements