Skip to content

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

TypeScript fluxerfluxerapp

refactor(api)!: drop unused helpers, parameters and a route (#2511)

Hampus34cf8f821f1a
diff --git a/fluxer_api/src/api/channel/controllers/MessageController.ts b/fluxer_api/src/api/channel/controllers/MessageController.ts
index 0ab5c72a8..1c640a1a1 100644
--- a/fluxer_api/src/api/channel/controllers/MessageController.ts
+++ b/fluxer_api/src/api/channel/controllers/MessageController.ts
@@ -423,20 +423,6 @@ export function MessageController(app: HonoApp) {
return ctx.body(null, 204);
},
);
- app.post(
- '/channels/:channel_id/messages/bulk_delete',
- RateLimitMiddleware(RateLimitConfigs.CHANNEL_MESSAGE_BULK_DELETE),
- LoginRequired,
- Validator('param', ChannelIdParam),
- Validator('json', BulkDeleteMessagesRequest),
- async (ctx) => {
- const userId = ctx.get('user').id;
- const channelId = createChannelID(ctx.req.valid('param').channel_id);
- const messageIds = ctx.req.valid('json').message_ids.map(createMessageID);
- await ctx.get('channelService').messages.deletion.bulkDeleteMessages({userId, channelId, messageIds});
- return ctx.body(null, 204);
- },
- );
app.post(
'/channels/:channel_id/messages/purge',
RateLimitMiddleware(RateLimitConfigs.CHANNEL_MESSAGE_PURGE),
diff --git a/fluxer_api/src/api/channel/services/AttachmentUploadService.ts b/fluxer_api/src/api/channel/services/AttachmentUploadService.ts
index b39b22347..2759c2f71 100644
--- a/fluxer_api/src/api/channel/services/AttachmentUploadService.ts
+++ b/fluxer_api/src/api/channel/services/AttachmentUploadService.ts
@@ -76,7 +76,6 @@ interface UploadFormDataAttachmentsParams {
id: number;
filename: string;
}>;
- expiresAt?: Date;
}
interface RequestPresignedAttachmentUploadUrlsParams {
@@ -113,7 +112,6 @@ export class AttachmentUploadService {
clientIp,
files,
attachmentMetadata,
- expiresAt,
}: UploadFormDataAttachmentsParams): Promise<Array<UploadedAttachment>> {
const {maxFileSize} = await this.getUploadPermissionAndLimit({userId, channelId});
assertAttachmentFileSizesWithinLimit(
@@ -138,7 +136,6 @@ export class AttachmentUploadService {
key: uploadKey,
body,
contentType,
- expiresAt: expiresAt ?? undefined,
}),
);
await this.attachmentUploadTraceRepository.recordRequestedUpload({
diff --git a/fluxer_api/src/api/channel/services/message/MessageRequestParser.ts b/fluxer_api/src/api/channel/services/message/MessageRequestParser.ts
index afe28f476..54aeb5e59 100644
--- a/fluxer_api/src/api/channel/services/message/MessageRequestParser.ts
+++ b/fluxer_api/src/api/channel/services/message/MessageRequestParser.ts
@@ -33,7 +33,6 @@ type MultipartBody = Record<string, string | File | Array<string | File>>;
type AttachmentMetadata = ClientAttachmentRequest | ClientUploadedAttachmentRequest | ClientAttachmentReferenceRequest;
interface ParseMultipartMessageDataOptions {
- uploadExpiresAt?: Date;
onPayloadParsed?: (payload: unknown) => void;
}
@@ -159,7 +158,6 @@ export async function parseMultipartMessageData(
clientIp,
files: filesWithIndices,
attachmentMetadata: inlineNewAttachments,
- expiresAt: options?.uploadExpiresAt,
});
const uploadedMap = new Map(uploadedAttachments.map((attachment) => [attachment.id, attachment]));
const processedInlineAttachments = inlineNewAttachments.map((clientData) => {
diff --git a/fluxer_api/src/api/user/services/UserAccountLookupService.ts b/fluxer_api/src/api/user/services/UserAccountLookupService.ts
index ae25ffc3f..f6018bbca 100644
--- a/fluxer_api/src/api/user/services/UserAccountLookupService.ts
+++ b/fluxer_api/src/api/user/services/UserAccountLookupService.ts
@@ -281,14 +281,6 @@ export class UserAccountLookupService {
}));
}
- async generateUniqueDiscriminator(username: string): Promise<number> {
- const usedDiscriminators = await this.deps.userAccountRepository.findDiscriminatorsByUsername(username);
- for (let i = 1; i <= 9999; i++) {
- if (!usedDiscriminators.has(i)) return i;
- }
- throw new Error('No available discriminators for this username');
- }
-
async checkUsernameDiscriminatorAvailability(params: {username: string; discriminator: number}): Promise<boolean> {
const {username, discriminator} = params;
const isAvailable = await this.deps.discriminatorService.isDiscriminatorAvailableForUsername(