fix(soundboard): read MANAGE_SPACE from the space bitfield
CI / Build & test (Node 20) (push) Canceled after 0s
CI / Build & test (Node 24) (push) Canceled after 0s
CI / Build & test (push) Canceled after 0s
CodeQL / Analyze (javascript-typescript) (push) Canceled after 0s
Security / Secret scan (gitleaks) (push) Canceled after 0s
Security / Dependency scan (OSV-Scanner) (push) Canceled after 0s
Security / IaC/config scan (Trivy) (push) Canceled after 0s
Security / License compliance scan (Trivy) (push) Canceled after 0s
OpenSSF Scorecard / Scorecard analysis (push) Canceled after 0s

The add-sound control was gated on channelPermissions, which carries the
per-channel bitfield; MANAGE_SPACE lives in the space-level one. The check
silently evaluated false for everybody, including owners, so the button never
rendered and there was no way to add a sound at all.

Also raise the clip cap to 2 MB — a 30-second clip at a high bitrate cleared
1 MB — and stop reporting every upload failure as 'too large', which sent
people to shrink a file that was not the problem.
This commit is contained in:
2026-08-31 13:54:00 -03:00
parent f5451e1b14
commit e89966435a
4 changed files with 13 additions and 5 deletions
@@ -12,7 +12,7 @@ interface SoundboardPopoverProps {
}
/** Clips are short gags; anything larger is a music file in disguise. */
const MAX_SOUND_BYTES = 1024 * 1024;
const MAX_SOUND_BYTES = 2 * 1024 * 1024;
export function SoundboardPopover({ spaceId, canManage, onClose }: SoundboardPopoverProps) {
const t = useT();
@@ -66,7 +66,9 @@ export function SoundboardPopover({ spaceId, canManage, onClose }: SoundboardPop
const created = await api.soundboard.add(spaceId, name, filename);
setSounds((prev) => [...prev, created]);
} catch {
setError(t('soundboard.tooLarge'));
// Distinct from the size check above: reporting every failure as "too
// large" sends people to shrink a file that was never the problem.
setError(t('soundboard.uploadFailed'));
} finally {
setUploading(false);
if (fileRef.current) fileRef.current.value = '';