Skip to content

A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.

TypeScript fluxerfluxerapp

fix(app): keep mature content consent across account switches (#3291)

Hampus0906a85d6f6f
diff --git a/fluxer_app/src/features/gateway/transport/GatewayConnectionAuthFailure.test.ts b/fluxer_app/src/features/gateway/transport/GatewayConnectionAuthFailure.test.ts
index be09069a4..af2e97391 100644
--- a/fluxer_app/src/features/gateway/transport/GatewayConnectionAuthFailure.test.ts
+++ b/fluxer_app/src/features/gateway/transport/GatewayConnectionAuthFailure.test.ts
@@ -107,8 +107,6 @@ vi.mock('@app/features/app/state/RuntimeCrash', () => ({default: {triggerFatalCr
vi.mock('@app/features/expressions/state/FavoriteMemes', () => ({default: {reset: vi.fn()}}));
-vi.mock('@app/features/guild/state/GuildMatureContentAgree', () => ({default: {reset: vi.fn()}}));
-
vi.mock('@app/features/member/state/MemberSearch', () => ({default: {handleLogout: vi.fn()}}));
vi.mock('@app/features/messaging/state/MessagingMessages', () => ({
diff --git a/fluxer_app/src/features/gateway/transport/GatewaySessionPool.test.ts b/fluxer_app/src/features/gateway/transport/GatewaySessionPool.test.ts
index a29e53426..db1caf2c8 100644
--- a/fluxer_app/src/features/gateway/transport/GatewaySessionPool.test.ts
+++ b/fluxer_app/src/features/gateway/transport/GatewaySessionPool.test.ts
@@ -131,8 +131,6 @@ vi.mock('@app/features/auth/state/Authentication', () => ({
vi.mock('@app/features/expressions/state/FavoriteMemes', () => ({default: {reset: vi.fn()}}));
-vi.mock('@app/features/guild/state/GuildMatureContentAgree', () => ({default: {reset: vi.fn()}}));
-
vi.mock('@app/features/member/state/MemberSearch', () => ({default: {handleLogout: vi.fn()}}));
vi.mock('@app/features/messaging/state/MessagingMessages', () => ({
diff --git a/fluxer_app/src/features/gateway/transport/PooledGatewayConnection.ts b/fluxer_app/src/features/gateway/transport/PooledGatewayConnection.ts
index 6a3b3719d..459b672a7 100644
--- a/fluxer_app/src/features/gateway/transport/PooledGatewayConnection.ts
+++ b/fluxer_app/src/features/gateway/transport/PooledGatewayConnection.ts
@@ -44,7 +44,6 @@ import {
type GatewayVoiceStateUpdateParams,
} from '@app/features/gateway/transport/GatewaySocket';
import {selectGuildActivationTarget} from '@app/features/gateway/transport/GuildActivationTarget';
-import GuildMatureContentAgree from '@app/features/guild/state/GuildMatureContentAgree';
import MemberSearch from '@app/features/member/state/MemberSearch';
import AttachmentUrlRefresher from '@app/features/messaging/state/AttachmentUrlRefresher';
import Messages from '@app/features/messaging/state/MessagingMessages';
@@ -957,7 +956,6 @@ export class PooledGatewayConnection {
Messages.handleSessionInvalidated();
FavoriteMemes.reset();
AttachmentUrlRefresher.reset();
- GuildMatureContentAgree.reset();
ChannelFrecency.handleLogout();
MemberSearch.handleLogout();
ThreadPanel.closeCreate();
diff --git a/fluxer_app/src/features/gateway/transport/PooledGatewayConnectionDispatch.test.ts b/fluxer_app/src/features/gateway/transport/PooledGatewayConnectionDispatch.test.ts
index 3c432bdf9..1ea4dafa8 100644
--- a/fluxer_app/src/features/gateway/transport/PooledGatewayConnectionDispatch.test.ts
+++ b/fluxer_app/src/features/gateway/transport/PooledGatewayConnectionDispatch.test.ts
@@ -101,8 +101,6 @@ vi.mock('@app/features/auth/state/Authentication', () => ({
vi.mock('@app/features/expressions/state/FavoriteMemes', () => ({default: {reset: vi.fn()}}));
-vi.mock('@app/features/guild/state/GuildMatureContentAgree', () => ({default: {reset: vi.fn()}}));
-
vi.mock('@app/features/member/state/MemberSearch', () => ({default: {handleLogout: vi.fn()}}));
vi.mock('@app/features/messaging/state/MessagingMessages', () => ({
diff --git a/fluxer_app/src/features/guild/state/GuildMatureContentAgree.test.ts b/fluxer_app/src/features/guild/state/GuildMatureContentAgree.test.ts
index b46d8973c..9006ea97b 100644
--- a/fluxer_app/src/features/guild/state/GuildMatureContentAgree.test.ts
+++ b/fluxer_app/src/features/guild/state/GuildMatureContentAgree.test.ts
@@ -37,7 +37,9 @@ function put(channel: WireChannel): void {
beforeEach(() => {
channels.clear();
- GuildMatureContentAgree.reset();
+ GuildMatureContentAgree.revokeChannel('parent');
+ GuildMatureContentAgree.revokeChannel('forum');
+ GuildMatureContentAgree.revokeCategory('category');
put({id: 'category', guild_id: 'guild', type: ChannelTypes.GUILD_CATEGORY, nsfw_override: null});
put({id: 'parent', guild_id: 'guild', type: ChannelTypes.GUILD_TEXT, parent_id: 'category', nsfw_override: null});
put({id: 'thread', guild_id: 'guild', type: ChannelTypes.PUBLIC_THREAD, parent_id: 'parent'});
diff --git a/fluxer_app/src/features/guild/state/GuildMatureContentAgree.ts b/fluxer_app/src/features/guild/state/GuildMatureContentAgree.ts
index cc45ed9b7..48e4d8c7b 100644
--- a/fluxer_app/src/features/guild/state/GuildMatureContentAgree.ts
+++ b/fluxer_app/src/features/guild/state/GuildMatureContentAgree.ts
@@ -128,13 +128,6 @@ class GuildMatureContentAgree {
}
}
- reset(): void {
- this.localAgreedChannelIds = [];
- this.agreedChannelIds = [];
- this.agreedCategoryIds = [];
- this.agreedGuildIds = [];
- }
-
revokeChannel(channelId: string): void {
this.localAgreedChannelIds = this.localAgreedChannelIds.filter((id) => id !== channelId);
this.agreedChannelIds = this.agreedChannelIds.filter((id) => id !== channelId);