mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-21 23:05:46 +00:00
fix(orbit): attribute bulk-added tracks to host in queue view
Album and playlist enqueues go through usePlayerStore.enqueue() directly, never through hostEnqueueToOrbit, so the tracks never land in state.queue. Our attribution map only covered state.queue entries, so bulk-added rows rendered with no label at all. Fall back to "Added by you" when a track is in the host's player queue but has no state.queue entry — the host added it themselves by definition (pre-session or bulk-add). The guest-side view already had this fallback via base.host in useOrbitHost.ts. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -264,13 +264,13 @@ function QueuePanelHostOrSolo() {
|
||||
}, [orbitRole, orbitState]);
|
||||
const orbitHostUsername = orbitState?.host ?? '';
|
||||
/** Attribution label for a queue row / current track while hosting. Null when
|
||||
* not hosting, when the track isn't part of the Orbit state, or when it
|
||||
* isn't relevant for this user (non-host and we haven't mapped the added-by). */
|
||||
* not in a hosted session. Bulk-adds (album / playlist enqueue) bypass
|
||||
* `hostEnqueueToOrbit` and therefore never land in `state.queue`, so we
|
||||
* default those to "Added by you" rather than showing nothing. */
|
||||
const orbitAttributionLabel = (trackId: string): string | null => {
|
||||
if (orbitRole !== 'host') return null;
|
||||
if (orbitRole !== 'host' || !orbitState) return null;
|
||||
const addedBy = orbitAddedByByTrack.get(trackId);
|
||||
if (!addedBy) return null;
|
||||
if (addedBy === orbitHostUsername) return t('orbit.queueAddedByYou');
|
||||
if (!addedBy || addedBy === orbitHostUsername) return t('orbit.queueAddedByYou');
|
||||
return t('orbit.queueAddedByUser', { user: addedBy });
|
||||
};
|
||||
const queue = usePlayerStore(s => s.queue);
|
||||
|
||||
Reference in New Issue
Block a user