chore(moderation): remove the built-in NCMEC integration (#3332)

This commit is contained in:
Hampus authored and GitHub committed 2026-10-09 01:39:04 +02:00
1 parent f390e610b9
commit 454fefdb92
146 files changed
+234 -4075

No files matched your search

@@ -9,7 +9,6 @@ import type {ChannelRepository} from '@app/api/channel/ChannelRepository';
import type {ChannelService} from '@app/api/channel/services/ChannelService';
import type {ConnectionRepository} from '@app/api/connection/ConnectionRepository';
import {ConnectionService} from '@app/api/connection/ConnectionService';
import type {NcmecSubmissionService} from '@app/api/csam/NcmecSubmissionService';
import {DonationRepository} from '@app/api/donation/DonationRepository';
import type {IDonationRepository} from '@app/api/donation/IDonationRepository';
import type {FavoriteMemeRepository} from '@app/api/favorite_meme/FavoriteMemeRepository';
@@ -75,7 +74,6 @@ import {
getKVActivityTracker,
getKVBulkMessageDeletionQueue,
getLimitConfigService,
getNcmecSubmissionService,
getOAuth2TokenRepository,
getPremiumStateReconciliationQueueService,
getPurgeQueue,
@@ -167,7 +165,6 @@ export interface WorkerDependencies {
channelService: ChannelService;
guildAuditLogService: GuildAuditLogService;
contactChangeLogService: UserContactChangeLogService;
ncmecSubmissionService: NcmecSubmissionService;
donationRepository: IDonationRepository;
guildService: GuildService;
billingRepository: BillingRepository;
@@ -207,7 +204,6 @@ export async function initializeWorkerDependencies(snowflakeService: ISnowflakeS
const connectionService = new ConnectionService(connectionRepository, gatewayService);
const mediaService = getMediaService();
const discriminatorService = getDiscriminatorService();
const ncmecSubmissionService = getNcmecSubmissionService();
const avatarService = getAvatarService();
const entityAssetService = getEntityAssetService();
await ensureVirusScanInitialized();
@@ -329,7 +325,6 @@ export async function initializeWorkerDependencies(snowflakeService: ISnowflakeS
storeEntitlementService,
guildAuditLogService,
contactChangeLogService,
ncmecSubmissionService,
get stripe() {
return getStripeClient();
},
@@ -44,7 +44,6 @@ const LANE_CONFIG = {
'bulkDeleteUserMessagesScoped',
'deleteUserMessagesInGuildByTime',
'messageShred',
'finalizeNcmecAttachmentReport',
'harvestGuildData',
'harvestUserData',
'batchGuildAuditLogMessageDeletes',
@@ -61,7 +60,7 @@ const LANE_CONFIG = {
'bulkDeleteMessagesForUsers',
'drainActivitySpool',
] as const,
retiredTasks: ['sendScheduledMessage'],
retiredTasks: ['sendScheduledMessage', 'finalizeNcmecAttachmentReport'],
concurrency: 8,
maxAckPending: 50,
ackWaitMs: 60000,
@@ -20,7 +20,6 @@ import expireAttachments from '@app/api/worker/tasks/ExpireAttachments';
import expireReportSnapshots from '@app/api/worker/tasks/ExpireReportSnapshots';
import expireStaleJobs from '@app/api/worker/tasks/ExpireStaleJobs';
import extractEmbeds from '@app/api/worker/tasks/ExtractEmbeds';
import finalizeNcmecAttachmentReport from '@app/api/worker/tasks/FinalizeNcmecAttachmentReport';
import flushUserActivityBuffer from '@app/api/worker/tasks/FlushUserActivityBuffer';
import handleMentionChunk from '@app/api/worker/tasks/HandleMentionChunk';
import handleMentions from '@app/api/worker/tasks/HandleMentions';
@@ -93,7 +92,6 @@ export const workerTasks: Record<WorkerTaskName, WorkerTaskHandler> = {
expireReportSnapshots,
expireStaleJobs,
extractEmbeds,
finalizeNcmecAttachmentReport,
handleMentions,
handleMentionChunk,
harvestGuildData,
@@ -1,26 +0,0 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import {createAttachmentID} from '@app/api/BrandedTypes';
import {Logger} from '@app/api/Logger';
import {getWorkerDependencies} from '@app/api/worker/WorkerContext';
import type {WorkerTaskHandler} from '@pkgs/worker/src/contracts/WorkerTask';
import {z} from 'zod';
const PayloadSchema = z.object({
attachmentId: z.string(),
requeueCount: z.number().int().min(0).optional(),
});
const finalizeNcmecAttachmentReport: WorkerTaskHandler = async (payload, helpers) => {
const validated = PayloadSchema.parse(payload);
helpers.logger.debug({payload: validated}, 'Processing finalizeNcmecAttachmentReport task');
const attachmentId = createAttachmentID(BigInt(validated.attachmentId));
try {
const deps = getWorkerDependencies();
await deps.ncmecSubmissionService.finalizeAttachmentReport(attachmentId, validated.requeueCount ?? 0);
} catch (error) {
Logger.error({error, attachmentId: attachmentId.toString()}, 'Failed to finalize NCMEC attachment report');
throw error;
}
};
export default finalizeNcmecAttachmentReport;
@@ -70,7 +70,7 @@ describe('WorkerLaneConfig', () => {
expect(retired).toEqual({
realtime: [],
unfurl: [],
lifecycle: ['sendScheduledMessage'],
lifecycle: ['sendScheduledMessage', 'finalizeNcmecAttachmentReport'],
batch: [],
crosspost: [],
});