mirror of
https://github.com/kilyabin/psysonic.git
synced 2026-07-22 06:25:41 +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:
@@ -1452,27 +1452,18 @@ export default function ContextMenu() {
|
||||
<ListPlus size={14} /> {t('contextMenu.addToQueue')}
|
||||
</div>
|
||||
{orbitRole === 'guest' && (() => {
|
||||
const gate = evaluateOrbitSuggestGate();
|
||||
const muted = gate.reason === 'muted';
|
||||
const capReached = gate.reason === 'cap-reached';
|
||||
const disabled = muted || capReached;
|
||||
const tooltip = muted
|
||||
? t('orbit.suggestBlockedMuted')
|
||||
: capReached ? t('orbit.suggestBlockedCap') : '';
|
||||
const muted = evaluateOrbitSuggestGate().reason === 'muted';
|
||||
return (
|
||||
<div
|
||||
className={`context-menu-item${disabled ? ' is-disabled' : ''}`}
|
||||
{...(disabled ? { 'data-tooltip': tooltip } : {})}
|
||||
className={`context-menu-item${muted ? ' is-disabled' : ''}`}
|
||||
{...(muted ? { 'data-tooltip': t('orbit.suggestBlockedMuted') } : {})}
|
||||
onClick={() => handleAction(() => {
|
||||
if (muted) { showToast(t('orbit.suggestBlockedMuted'), 3500, 'error'); return; }
|
||||
if (capReached) { showToast(t('orbit.suggestBlockedCap'), 3500, 'info'); return; }
|
||||
if (muted) { showToast(t('orbit.suggestBlockedMuted'), 3500, 'error'); return; }
|
||||
suggestOrbitTrack(song.id)
|
||||
.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');
|
||||
}
|
||||
@@ -1625,27 +1616,18 @@ export default function ContextMenu() {
|
||||
<ListPlus size={14} /> {t('contextMenu.addToQueue')}
|
||||
</div>
|
||||
{orbitRole === 'guest' && (() => {
|
||||
const gate = evaluateOrbitSuggestGate();
|
||||
const muted = gate.reason === 'muted';
|
||||
const capReached = gate.reason === 'cap-reached';
|
||||
const disabled = muted || capReached;
|
||||
const tooltip = muted
|
||||
? t('orbit.suggestBlockedMuted')
|
||||
: capReached ? t('orbit.suggestBlockedCap') : '';
|
||||
const muted = evaluateOrbitSuggestGate().reason === 'muted';
|
||||
return (
|
||||
<div
|
||||
className={`context-menu-item${disabled ? ' is-disabled' : ''}`}
|
||||
{...(disabled ? { 'data-tooltip': tooltip } : {})}
|
||||
className={`context-menu-item${muted ? ' is-disabled' : ''}`}
|
||||
{...(muted ? { 'data-tooltip': t('orbit.suggestBlockedMuted') } : {})}
|
||||
onClick={() => handleAction(() => {
|
||||
if (muted) { showToast(t('orbit.suggestBlockedMuted'), 3500, 'error'); return; }
|
||||
if (capReached) { showToast(t('orbit.suggestBlockedCap'), 3500, 'info'); return; }
|
||||
if (muted) { showToast(t('orbit.suggestBlockedMuted'), 3500, 'error'); return; }
|
||||
suggestOrbitTrack(song.id)
|
||||
.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');
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Users, Wifi, WifiOff, Inbox } from 'lucide-react';
|
||||
import { Users, Wifi, WifiOff } from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useOrbitStore } from '../store/orbitStore';
|
||||
import type { OrbitState } from '../api/orbit';
|
||||
@@ -36,15 +36,6 @@ export default function OrbitQueueHead({ state }: Props) {
|
||||
const names = [state.host, ...state.participants.map(p => p.user)];
|
||||
const showPresence = role === 'guest' && state.positionAt > 0;
|
||||
const hostAway = showPresence && (nowMs - state.positionAt) > HOST_AWAY_THRESHOLD_MS;
|
||||
const cap = state.settings?.maxPending ?? 0;
|
||||
// Authoritative count comes from the host's own tick (state.pendingApprovalCount).
|
||||
// Older clients that predate that field fall back to the raw queue length
|
||||
// — that one over-counts because merged/declined items stay in state.queue
|
||||
// as history, but it's the best a non-host client can do.
|
||||
const pendingCount = cap > 0
|
||||
? (state.pendingApprovalCount
|
||||
?? state.queue.filter(q => q.addedBy !== state.host).length)
|
||||
: 0;
|
||||
|
||||
return (
|
||||
<div className="orbit-queue-head">
|
||||
@@ -63,15 +54,6 @@ export default function OrbitQueueHead({ state }: Props) {
|
||||
<div className="orbit-queue-head__meta">
|
||||
<Users size={11} />
|
||||
<span className="orbit-queue-head__names">{names.join(', ')}</span>
|
||||
{cap > 0 && (
|
||||
<span
|
||||
className={`orbit-queue-head__pending${pendingCount >= cap ? ' is-full' : ''}`}
|
||||
data-tooltip={t('orbit.pendingCounterTooltip')}
|
||||
>
|
||||
<Inbox size={11} />
|
||||
<span>{t('orbit.pendingCounter', { count: pendingCount, max: cap })}</span>
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -82,27 +82,6 @@ export default function OrbitSettingsPopover({ anchorRef, onClose }: Props) {
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<label className="orbit-settings-pop__row">
|
||||
<div className="orbit-settings-pop__text">
|
||||
<div className="orbit-settings-pop__label">{t('orbit.settingMaxPending')}</div>
|
||||
<div className="orbit-settings-pop__hint">{t('orbit.settingMaxPendingHint')}</div>
|
||||
</div>
|
||||
<input
|
||||
type="number"
|
||||
min={0}
|
||||
max={999}
|
||||
step={1}
|
||||
value={settings.maxPending ?? 0}
|
||||
onChange={e => {
|
||||
const raw = parseInt(e.target.value, 10);
|
||||
const next = Number.isFinite(raw) && raw >= 0 ? Math.min(raw, 999) : 0;
|
||||
void updateOrbitSettings({ maxPending: next });
|
||||
}}
|
||||
className="orbit-settings-pop__number"
|
||||
aria-label={t('orbit.settingMaxPending')}
|
||||
/>
|
||||
</label>
|
||||
|
||||
<div className="orbit-settings-pop__row orbit-settings-pop__row--stacked">
|
||||
<div className="orbit-settings-pop__text">
|
||||
<div className="orbit-settings-pop__label">{t('orbit.settingShuffleInterval')}</div>
|
||||
|
||||
Reference in New Issue
Block a user