mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-22 07:15:47 +00:00
revert(orbit): drop maxPending cap feature, keep suggestion mute
The pending counter desynced from the actual approval list (state.queue holds approved items as history, so the count never decreased after a host approve). The host-pushed pendingApprovalCount workaround didn't hold up under live testing either, so we're rolling the whole cap feature back rather than ship something flaky. What's gone: - OrbitSettings.maxPending + state.pendingApprovalCount - cap branch in applyOutboxSnapshotsToState (now back to mute-only) - maxPending number input in settings popover - pending counter chip in OrbitQueueHead - 'cap-reached' branch in evaluateOrbitSuggestGate / OrbitSuggestGateReason - cap-related toasts in ContextMenu / useOrbitSongRowBehavior - cap-related i18n keys (suggestBlockedCap, settingMaxPending*, pendingCounter*) - cap CSS (.orbit-queue-head__pending, .orbit-settings-pop__number) What stays: per-guest suggestion mute (works correctly) and everything that fed into both features (OrbitState.suggestionBlocked, setOrbitSuggestionBlocked, evaluateOrbitSuggestGate, the participants popover Mic/MicOff toggle, the suggestBlockedMuted toast). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -87,12 +87,7 @@ export function useOrbitHost(): void {
|
||||
let afterSweep = base;
|
||||
try {
|
||||
const snaps = await sweepGuestOutboxes(base.sid, base.host);
|
||||
// Hand the cap-check the host's local merged/declined sets so it can
|
||||
// tell which `state.queue` items are still actually awaiting approval.
|
||||
afterSweep = applyOutboxSnapshotsToState(base, snaps, Date.now(), {
|
||||
mergedKeys: new Set(store.mergedSuggestionKeys),
|
||||
declinedKeys: new Set(store.declinedSuggestionKeys),
|
||||
});
|
||||
afterSweep = applyOutboxSnapshotsToState(base, snaps);
|
||||
} catch { /* best-effort; keep old participants and queue */ }
|
||||
|
||||
// 2) Merge newly-suggested items into the host's local play queue so
|
||||
@@ -130,24 +125,11 @@ export function useOrbitHost(): void {
|
||||
trackId: t.id,
|
||||
addedBy: suggesterByTrack.get(t.id) ?? base.host,
|
||||
}));
|
||||
// Authoritative pending count — same predicate the approval list uses
|
||||
// (state.queue minus host-authored, minus merged, minus declined). We
|
||||
// recompute fresh each tick from the *current* store sets so an approve
|
||||
// / decline that happened mid-sweep is reflected on the very next push.
|
||||
const mergedNow = new Set(useOrbitStore.getState().mergedSuggestionKeys);
|
||||
const declinedNow = new Set(useOrbitStore.getState().declinedSuggestionKeys);
|
||||
const pendingApprovalCount = afterShuffle.queue.filter(q =>
|
||||
q.addedBy !== afterShuffle.host
|
||||
&& !mergedNow.has(suggestionKey(q))
|
||||
&& !declinedNow.has(suggestionKey(q))
|
||||
).length;
|
||||
|
||||
const next: OrbitState = {
|
||||
...afterShuffle,
|
||||
...snapshotPlayerPatch(base.host),
|
||||
playQueue,
|
||||
playQueueTotal: upcoming.length,
|
||||
pendingApprovalCount,
|
||||
};
|
||||
|
||||
// 5) Commit locally + push remote.
|
||||
|
||||
@@ -53,17 +53,11 @@ export function useOrbitSongRowBehavior() {
|
||||
showToast(t('orbit.suggestBlockedMuted'), 3500, 'error');
|
||||
return;
|
||||
}
|
||||
if (!gate.allowed && gate.reason === 'cap-reached') {
|
||||
showToast(t('orbit.suggestBlockedCap'), 3500, 'info');
|
||||
return;
|
||||
}
|
||||
suggestOrbitTrack(songId)
|
||||
.then(() => showToast(t('orbit.ctxSuggestedToast'), 2200, 'info'))
|
||||
.catch(err => {
|
||||
if (err instanceof OrbitSuggestBlockedError && err.reason === 'muted') {
|
||||
showToast(t('orbit.suggestBlockedMuted'), 3500, 'error');
|
||||
} else if (err instanceof OrbitSuggestBlockedError && err.reason === 'cap-reached') {
|
||||
showToast(t('orbit.suggestBlockedCap'), 3500, 'info');
|
||||
} else {
|
||||
showToast(t('orbit.ctxSuggestFailed'), 3000, 'error');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user