mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-30 01:12:39 +00:00
Merge pull request #941 from PR0M3TH3AN/codex/fix-video-grid-filtering-after-profile-switch
Ensure moderation settings refresh on profile changes
This commit is contained in:
1 file changed
+46
-8
@@ -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 });
|
||||
|
||||
Reference in new issue
Block a user