A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.
refactor(api): drop unused request cache and DM delete helper
Hampus90ca277e5a77
diff --git a/fluxer_api/src/api/user/controllers/UserContentController.ts b/fluxer_api/src/api/user/controllers/UserContentController.tsindex 9a2227e01..7cfa1248e 100644--- a/fluxer_api/src/api/user/controllers/UserContentController.ts+++ b/fluxer_api/src/api/user/controllers/UserContentController.ts@@ -56,7 +56,6 @@ export function UserContentController(app: HonoApp) {roles,guilds,before: before ? createMessageID(before) : undefined,- requestCache: ctx.get('requestCache'),});return ctx.json(response);},@@ -133,7 +132,6 @@ export function UserContentController(app: HonoApp) {userId: ctx.get('user').id,limit,before: before ? createMessageID(before) : undefined,- requestCache: ctx.get('requestCache'),});return ctx.json(response, 200);},@@ -161,7 +159,6 @@ export function UserContentController(app: HonoApp) {userId: ctx.get('user').id,channelId: createChannelID(channel_id),messageId: createMessageID(message_id),- requestCache: ctx.get('requestCache'),});return ctx.body(null, 204);},diff --git a/fluxer_api/src/api/user/repositories/UserChannelRepository.ts b/fluxer_api/src/api/user/repositories/UserChannelRepository.tsindex 154d9d3fa..ed08783db 100644--- a/fluxer_api/src/api/user/repositories/UserChannelRepository.ts+++ b/fluxer_api/src/api/user/repositories/UserChannelRepository.ts@@ -13,7 +13,6 @@ import {fetchOne,upsertOne,} from '@app/api/database/CassandraQueryExecution';-import {Db} from '@app/api/database/CassandraTypes';import type {ChannelRow, DmStateRow, PrivateChannelRow} from '@app/api/database/types/ChannelTypes';import {Logger} from '@app/api/Logger';import {Channel} from '@app/api/models/Channel';@@ -255,15 +254,6 @@ export class UserChannelRepository {return new Channel(channelRow);}- async deleteAllPrivateChannels(userId: UserID): Promise<void> {- await deleteOneOrMany(- PrivateChannels.deleteCql({- where: PrivateChannels.where.eq('user_id'),- }),- {user_id: userId},- );- }-async deleteAllReadStates(userId: UserID): Promise<void> {await deleteOneOrMany(ReadStates.deleteCql({@@ -670,22 +660,6 @@ export class UserChannelRepository {});}- async openDmForUser(userId: UserID, channelId: ChannelID, isGroupDm?: boolean): Promise<void> {- const channelRow = await fetchOne<ChannelRow>(FETCH_CHANNEL_CQL, {- channel_id: channelId,- soft_deleted: false,- });- if (channelRow) {- await this.openPrivateChannelForUser(userId, new Channel(channelRow));- return;- }- const resolvedIsGroupDm = isGroupDm ?? false;- await this.recordHistoricalDmChannel(userId, channelId, resolvedIsGroupDm);- await upsertOne(- PrivateChannels.patchByPk({user_id: userId, channel_id: channelId}, {is_gdm: Db.set(resolvedIsGroupDm)}),- );- }-async openPrivateChannelForUser(userId: UserID, channel: Channel): Promise<void> {const isGroupDm = channel.type === ChannelTypes.GROUP_DM;await this.recordHistoricalDmChannel(userId, channel.id, isGroupDm);@@ -697,7 +671,7 @@ export class UserChannelRepository {);}- async recordHistoricalDmChannel(userId: UserID, channelId: ChannelID, isGroupDm: boolean): Promise<void> {+ private async recordHistoricalDmChannel(userId: UserID, channelId: ChannelID, isGroupDm: boolean): Promise<void> {if (isGroupDm) {return;}diff --git a/fluxer_api/src/api/user/services/UserContentRequestService.ts b/fluxer_api/src/api/user/services/UserContentRequestService.tsindex 233076162..53345a840 100644--- a/fluxer_api/src/api/user/services/UserContentRequestService.ts+++ b/fluxer_api/src/api/user/services/UserContentRequestService.ts@@ -3,8 +3,6 @@import type {ChannelID, MessageID, UserID} from '@app/api/BrandedTypes';import type {ThreadViewer} from '@app/api/experiment/ChannelThreadsGate';import type {IStorageService} from '@app/api/infrastructure/IStorageService';-import type {UserCacheService} from '@app/api/infrastructure/UserCacheService';-import type {RequestCache} from '@app/api/middleware/RequestCacheMiddleware';import type {Message} from '@app/api/models/Message';import type {SavedMessageEntry, UserContentService} from '@app/api/user/services/UserContentService';import type {MessageListResponse, MessageResponse} from '@fluxer/schema/src/domains/message/MessageResponseSchemas';@@ -29,7 +27,6 @@ interface UserMentionsParams {everyone: boolean;guilds: boolean;before?: MessageID;- requestCache: RequestCache;}interface UserMentionDeleteParams {@@ -47,7 +44,6 @@ interface SavedMessagesParams {viewer: ThreadViewer;limit: number;before?: MessageID;- requestCache: RequestCache;}interface SaveMessageParams {@@ -55,7 +51,6 @@ interface SaveMessageParams {viewer: ThreadViewer;channelId: ChannelID;messageId: MessageID;- requestCache: RequestCache;}interface UnsaveMessageParams {@@ -84,10 +79,7 @@ interface HarvestDownloadParams {}export class UserContentRequestService {- constructor(- private readonly userContentService: UserContentService,- private readonly userCacheService: UserCacheService,- ) {}+ constructor(private readonly userContentService: UserContentService) {}async listMentions(params: UserMentionsParams): Promise<MessageListResponse> {const messages = await this.userContentService.getRecentMentions({@@ -135,8 +127,6 @@ export class UserContentRequestService {viewer: params.viewer,channelId: params.channelId,messageId: params.messageId,- userCacheService: this.userCacheService,- requestCache: params.requestCache,});}