feat(discovery): more work on discovery plus a few fixes

This commit is contained in:
Hampus Kraft committed 2026-02-17 15:41:08 +00:00
1 parent b19e9fb243
commit 302c0d2a0c
137 files changed
+7116 -2047

No files matched your search

+1 -13
View File
@@ -24,13 +24,10 @@ import AuthenticationStore from '@app/stores/AuthenticationStore';
import ChannelStore from '@app/stores/ChannelStore';
import GuildAvailabilityStore from '@app/stores/GuildAvailabilityStore';
import InitializationStore from '@app/stores/InitializationStore';
import PermissionStore from '@app/stores/PermissionStore';
import ReadStateStore from '@app/stores/ReadStateStore';
import {Permissions} from '@fluxer/constants/src/ChannelConstants';
import {reaction} from 'mobx';
const logger = new Logger('ReadStateCleanup');
const CAN_READ_PERMISSIONS = Permissions.VIEW_CHANNEL;
const CLEANUP_INTERVAL_MS = 300;
const sleep = (ms: number) => new Promise<void>((resolve) => setTimeout(resolve, ms));
@@ -41,16 +38,7 @@ let cleanupReactionDisposer: (() => void) | null = null;
function collectStaleChannels(): Array<string> {
const channelIds = ReadStateStore.getChannelIds();
return channelIds.filter((channelId) => {
const channel = ChannelStore.getChannel(channelId);
if (channel == null) {
return true;
}
if (channel.guildId == null) {
return false;
}
return !PermissionStore.can(CAN_READ_PERMISSIONS, channel);
return ChannelStore.getChannel(channelId) == null;
});
}