mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-28 16:32:28 +00:00
Fix: Enforce trusted mutes as blocks for anonymous users
Updates `js/app.js` to:
1. Treat Trusted Seed mutes as hard blocks (`isAuthorBlocked` returns `true`) for anonymous users ("session actors"), ensuring strict filtering.
2. Refresh the entire video grid (`refreshAllVideoGrids`) instead of just the UI (`refreshVisibleModerationUi`) when `trusted-mutes` events arrive for anonymous users, ensuring blocked content is removed dynamically once the lists load. This fixes a race condition where content might render before the block list is fully fetched.
This commit is contained in:
1 parent
dc476392b2
commit
d92cc58fc6
1 file changed
+21
-2
@@ -328,7 +328,22 @@ class Application {
|
||||
isAuthorBlocked(pubkey) {
|
||||
try {
|
||||
if (userBlocks && typeof userBlocks.isBlocked === "function") {
|
||||
return userBlocks.isBlocked(pubkey);
|
||||
if (userBlocks.isBlocked(pubkey)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.isUserLoggedIn()) {
|
||||
const normalized = this.normalizeHexPubkey(pubkey);
|
||||
if (
|
||||
normalized &&
|
||||
moderationService &&
|
||||
typeof moderationService.isAuthorMutedByTrusted === "function"
|
||||
) {
|
||||
if (moderationService.isAuthorMutedByTrusted(normalized)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
devLogger.warn("[Application] Failed to evaluate block status:", error);
|
||||
@@ -2653,7 +2668,11 @@ class Application {
|
||||
setupEventListeners() {
|
||||
if (moderationService && typeof moderationService.on === "function") {
|
||||
moderationService.on("trusted-mutes", () => {
|
||||
this.refreshVisibleModerationUi({ reason: "trusted-mutes" });
|
||||
if (!this.isUserLoggedIn()) {
|
||||
this.refreshAllVideoGrids({ reason: "trusted-mutes" });
|
||||
} else {
|
||||
this.refreshVisibleModerationUi({ reason: "trusted-mutes" });
|
||||
}
|
||||
});
|
||||
moderationService.on("user-blocks", () => {
|
||||
this.refreshVisibleModerationUi({ reason: "user-blocks" });
|
||||
|
||||
Reference in new issue
Block a user