From 410ff28b5ee4cd937b4557a370e6e1aa0777a9a0 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Sun, 26 Oct 2025 18:04:19 -0400 Subject: [PATCH] Ensure moderation settings follow active profile --- js/app.js | 54 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 46 insertions(+), 8 deletions(-) diff --git a/js/app.js b/js/app.js index b78d72f3..5dfb8a50 100644 --- a/js/app.js +++ b/js/app.js @@ -5014,6 +5014,18 @@ class Application { } } + try { + await this.handleModerationSettingsChange({ + settings: getModerationSettings(), + skipRefresh: true, + }); + } catch (error) { + devLogger.warn( + "Failed to sync moderation settings after profile switch:", + error, + ); + } + let refreshPromise = null; if ( this.lastIdentityRefreshPromise && @@ -5322,7 +5334,7 @@ class Application { return null; } - async handleModerationSettingsChange({ settings } = {}) { + async handleModerationSettingsChange({ settings, skipRefresh = false } = {}) { const normalized = this.normalizeModerationSettings(settings); this.moderationSettings = normalized; @@ -5368,13 +5380,15 @@ class Application { this.decorateVideoModeration(this.currentVideo); } - try { - await this.onVideosShouldRefresh({ reason: "moderation-settings-change" }); - } catch (error) { - devLogger.warn( - "[Application] Failed to refresh videos after moderation settings change:", - error, - ); + if (!skipRefresh) { + try { + await this.onVideosShouldRefresh({ reason: "moderation-settings-change" }); + } catch (error) { + devLogger.warn( + "[Application] Failed to refresh videos after moderation settings change:", + error, + ); + } } return normalized; @@ -5593,6 +5607,18 @@ class Application { identityChanged: Boolean(detail?.identityChanged), }; + try { + await this.handleModerationSettingsChange({ + settings: getModerationSettings(), + skipRefresh: true, + }); + } catch (error) { + devLogger.warn( + "Failed to sync moderation settings after login:", + error, + ); + } + if (loginContext.identityChanged) { this.resetHashtagPreferencesState(); try { @@ -5812,6 +5838,18 @@ class Application { this.applyLoggedOutUiState(); this.applyCommentComposerAuthState(); + try { + await this.handleModerationSettingsChange({ + settings: getModerationSettings(), + skipRefresh: true, + }); + } catch (error) { + devLogger.warn( + "Failed to reset moderation settings after logout:", + error, + ); + } + if (this.videoModal?.closeZapDialog) { try { this.videoModal.closeZapDialog({ silent: true, restoreFocus: false });