mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-08 05:43:04 +00:00
fix(moderation): prevent clearing trusted mute lists on network failure and ensure UI updates
This commit fixes a critical security/UX regression where Trusted Seed mute lists (Kind 10000) were being cleared ("fail-open") if the initial network fetch failed or timed out. This left anonymous users exposed to blocked content until a subsequent update or refresh.
Changes:
- **`js/services/moderationService.js`**:
- Refactored `subscribeToTrustedMuteList` to use a retry mechanism (3 attempts with backoff) for fetching mute lists.
- Modified error handling to distinguish between "successful empty fetch" and "network failure".
- Prevented `replaceTrustedMuteList` (which clears the local state) from being called if the fetch fails, preserving any existing protection.
- **`js/app.js`**:
- Added a listener for the `trusted-mutes` event in `setupEventListeners`.
- This triggers `refreshVisibleModerationUi({ reason: "trusted-mutes" })`, ensuring that the UI (blurred thumbnails, hidden content) updates immediately when trusted mute lists are hydrated, without requiring a manual page refresh.
This ensures robust moderation for session actors (unauthenticated users) even under flaky network conditions.
This commit is contained in:
1 parent
fcccce68e2
commit
c777f0f068