BUG: Missing Ombi link for TV requests and missing *Arr links for all requests #56

Closed
opened 2026-05-27 21:56:53 +01:00 by Gandalf · 1 comment
Owner

Problem Summary

There are two distinct visual bugs preventing external service navigation links from appearing on request cards in the dashboard requests tab:

  1. Ombi link button: The Ombi details button (ombi-link) does not appear on any TV show request cards, although it shows up correctly on movie request cards.
  2. *Arr link buttons: The Sonarr/Radarr direct link buttons (sonarr-link/radarr-link) do not appear on any TV show or movie request cards, even for authenticated administrator users who should have access.

These links are crucial for quickly jumping to the respective Ombi/Sonarr/Radarr pages for item management.


Steps to Reproduce

  1. Connect and sync an Ombi instance and at least one Sonarr/Radarr instance.
  2. Log in to the Sofarr dashboard as an Admin user.
  3. Navigate to the Requests tab.
  4. Observe that:
    • Movie request cards have the Ombi (green circular) button but no Radarr direct link button.
    • TV show request cards have no Ombi button and no Sonarr direct link button.
  5. Switch to a TV show request detail page or check the raw requests SSE stream response (GET /api/dashboard/stream) to verify missing field properties.

Root Cause Analysis

1. Ombi Link Button for TV Shows (Frontend Issue)

  • File: requests.js
  • Lines: 197-211
  • Cause: The check for rendering the Ombi button is:
    if (state.ombiBaseUrl && request.theMovieDbId) {
    
    However, TV show requests in the Ombi API do not populate theMovieDbId (which is a Movie DB ID). Instead, they populate the TVDB ID (theTvDbId or other variations like theTvdbId, TvDbId, TheTvDbId). Since request.theMovieDbId is undefined for TV shows, the condition fails and no button is rendered.
    Additionally, the URL itself is currently hardcoded to use request.theMovieDbId:
    ombiLink.href = `${state.ombiBaseUrl}/details/${request.mediaType || 'movie'}/${request.theMovieDbId}`;
    
    But Ombi's TV detail pages use the TVDB ID in the format ${ombiBaseUrl}/details/tv/${tvdbId}.

2. *Arr Direct Link Buttons for Request Cards (Backend/SSE Issue)

  • File: dashboard.js vs ombi.js
  • Cause:
    The frontend checks state.isAdmin && request.arrLink to determine if a Sonarr/Radarr link button should be rendered:
    if (state.isAdmin && request.arrLink) {
    
    The logic to match TV/Movie requests to Sonarr series / Radarr movies and decorate the request objects with arrLink and arrType is implemented only in the standalone API route GET /api/ombi/requests in server/routes/ombi.js.
    However, the frontend dashboard actually gets all its real-time requests data from the Server-Sent Events (SSE) stream (GET /api/dashboard/stream) managed in server/routes/dashboard.js. In the SSE stream handler, the requests are simply read from the poll cache and filtered by user, without ever executing the matching logic to attach arrLink and arrType.
    As a result, request.arrLink is always undefined when pushed via SSE, so the buttons are never drawn.

Expected Behavior

  • TV Requests: Should have a functioning Ombi link pointing to ${ombiBaseUrl}/details/tv/${tvdbId}.
  • Admin Users: Should see Sonarr direct links on TV requests and Radarr direct links on movie requests in the Requests tab (matching the corresponding items already synced in Sonarr/Radarr).

Proposed Solution

1. Fix the Frontend Ombi Link Checks

Modify requests.js to resolve the correct identifier based on media type:

  const ombiId = request.mediaType === 'movie'
    ? (request.theMovieDbId || request.theTmdbId || request.TheMovieDbId)
    : (request.theTvDbId || request.theTvdbId || request.TvDbId || request.TheTvDbId || request.theMovieDbId);

  if (state.ombiBaseUrl && ombiId) {
    const ombiLink = document.createElement('a');
    ombiLink.className = 'ombi-link';
    ombiLink.href = `${state.ombiBaseUrl}/details/${request.mediaType || 'movie'}/${ombiId}`;
    ...

2. Refactor and Share the *Arr Matching Logic

Extract the Sonarr/Radarr series and movie lookup/matching block from server/routes/ombi.js into a shared utility function or helper in server/utils/ombiHelpers.js or server/services/DownloadAssembler.js (e.g., decorateRequestsWithArrLinks(movieRequests, tvRequests, isAdmin)).

3. Integrate *Arr Decoration into SSE Stream

Call this shared decorator function in the SSE handler inside server/routes/dashboard.js before writing the SSE payload to the socket, so that admins receive the matched arrLink and arrType fields in real-time.


Additional Context

  • This issue is medium severity because it does not crash the system, but it degrades user experience and blocks admin utility navigation.
  • No database changes or schema updates are needed.
  • Unit and integration tests (such as requests.test.js) should be updated to verify the corrected rendering behavior.
## Problem Summary There are two distinct visual bugs preventing external service navigation links from appearing on request cards in the dashboard requests tab: 1. **Ombi link button:** The Ombi details button (`ombi-link`) does not appear on any TV show request cards, although it shows up correctly on movie request cards. 2. ***Arr link buttons:** The Sonarr/Radarr direct link buttons (`sonarr-link`/`radarr-link`) do not appear on any TV show or movie request cards, even for authenticated administrator users who should have access. These links are crucial for quickly jumping to the respective Ombi/Sonarr/Radarr pages for item management. -------- ## Steps to Reproduce 1. Connect and sync an Ombi instance and at least one Sonarr/Radarr instance. 2. Log in to the Sofarr dashboard as an **Admin** user. 3. Navigate to the **Requests** tab. 4. Observe that: - Movie request cards have the Ombi (green circular) button but **no Radarr direct link button**. - TV show request cards have **no Ombi button** and **no Sonarr direct link button**. 5. Switch to a TV show request detail page or check the raw requests SSE stream response (`GET /api/dashboard/stream`) to verify missing field properties. -------- ## Root Cause Analysis ### 1. Ombi Link Button for TV Shows (Frontend Issue) * **File:** [requests.js](file:///home/gordon/CascadeProjects/sofarr/client/src/ui/requests.js#L197-L211) * **Lines:** 197-211 * **Cause:** The check for rendering the Ombi button is: ```javascript if (state.ombiBaseUrl && request.theMovieDbId) { ``` However, TV show requests in the Ombi API do not populate `theMovieDbId` (which is a Movie DB ID). Instead, they populate the TVDB ID (`theTvDbId` or other variations like `theTvdbId`, `TvDbId`, `TheTvDbId`). Since `request.theMovieDbId` is undefined for TV shows, the condition fails and no button is rendered. Additionally, the URL itself is currently hardcoded to use `request.theMovieDbId`: ```javascript ombiLink.href = `${state.ombiBaseUrl}/details/${request.mediaType || 'movie'}/${request.theMovieDbId}`; ``` But Ombi's TV detail pages use the TVDB ID in the format `${ombiBaseUrl}/details/tv/${tvdbId}`. ### 2. *Arr Direct Link Buttons for Request Cards (Backend/SSE Issue) * **File:** [dashboard.js](file:///home/gordon/CascadeProjects/sofarr/server/routes/dashboard.js#L523-L536) vs [ombi.js](file:///home/gordon/CascadeProjects/sofarr/server/routes/ombi.js#L123-L181) * **Cause:** The frontend checks `state.isAdmin && request.arrLink` to determine if a Sonarr/Radarr link button should be rendered: ```javascript if (state.isAdmin && request.arrLink) { ``` The logic to match TV/Movie requests to Sonarr series / Radarr movies and decorate the request objects with `arrLink` and `arrType` is implemented **only** in the standalone API route `GET /api/ombi/requests` in `server/routes/ombi.js`. However, the frontend dashboard actually gets all its real-time requests data from the Server-Sent Events (SSE) stream (`GET /api/dashboard/stream`) managed in `server/routes/dashboard.js`. In the SSE stream handler, the requests are simply read from the poll cache and filtered by user, **without ever executing the matching logic to attach `arrLink` and `arrType`**. As a result, `request.arrLink` is always undefined when pushed via SSE, so the buttons are never drawn. -------- ## Expected Behavior - **TV Requests:** Should have a functioning Ombi link pointing to `${ombiBaseUrl}/details/tv/${tvdbId}`. - **Admin Users:** Should see Sonarr direct links on TV requests and Radarr direct links on movie requests in the Requests tab (matching the corresponding items already synced in Sonarr/Radarr). -------- ## Proposed Solution ### 1. Fix the Frontend Ombi Link Checks Modify [requests.js](file:///home/gordon/CascadeProjects/sofarr/client/src/ui/requests.js) to resolve the correct identifier based on media type: ```javascript const ombiId = request.mediaType === 'movie' ? (request.theMovieDbId || request.theTmdbId || request.TheMovieDbId) : (request.theTvDbId || request.theTvdbId || request.TvDbId || request.TheTvDbId || request.theMovieDbId); if (state.ombiBaseUrl && ombiId) { const ombiLink = document.createElement('a'); ombiLink.className = 'ombi-link'; ombiLink.href = `${state.ombiBaseUrl}/details/${request.mediaType || 'movie'}/${ombiId}`; ... ``` ### 2. Refactor and Share the *Arr Matching Logic Extract the Sonarr/Radarr series and movie lookup/matching block from `server/routes/ombi.js` into a shared utility function or helper in `server/utils/ombiHelpers.js` or `server/services/DownloadAssembler.js` (e.g., `decorateRequestsWithArrLinks(movieRequests, tvRequests, isAdmin)`). ### 3. Integrate *Arr Decoration into SSE Stream Call this shared decorator function in the SSE handler inside `server/routes/dashboard.js` before writing the SSE payload to the socket, so that admins receive the matched `arrLink` and `arrType` fields in real-time. -------- ## Additional Context - This issue is medium severity because it does not crash the system, but it degrades user experience and blocks admin utility navigation. - No database changes or schema updates are needed. - Unit and integration tests (such as `requests.test.js`) should be updated to verify the corrected rendering behavior.
Gandalf added the Kind/Bug
Priority
Medium
3
labels 2026-05-27 21:56:53 +01:00
Author
Owner

Resolved in commit 0eaa54cf4a.

Resolved in commit 0eaa54cf4a1d9b3063f04517681958067c115fd8.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Gandalf/sofarr#56