Fix DM not parsed in data export

This commit is contained in:
MartinBraquet
2026-02-13 17:36:12 +01:00
parent 8ff5b8a577
commit 7437a2fb45
3 changed files with 9 additions and 6 deletions

View File

@@ -101,7 +101,7 @@ export const getChannelMessagesEndpoint: APIHandler<'get-channel-messages'> = as
export async function getChannelMessages(props: {
channelId: number;
limit: number;
limit?: number;
id?: number | undefined;
userId: string;
}) {
@@ -119,7 +119,7 @@ export async function getChannelMessages(props: {
and ($4 is null or id > $4)
and not visibility = 'system_status'
order by created_time desc
limit $3
${limit ? 'limit $3' : ''}
`,
[channelId, userId, limit, id],
convertPrivateChatMessage

View File

@@ -3,6 +3,7 @@ import {createSupabaseDirectClient} from 'shared/supabase/init'
import {Row} from 'common/supabase/utils'
import {getLikesAndShipsMain} from './get-likes-and-ships'
import {parseJsonContentToText} from 'common/util/parse'
import {parseMessageObject} from "shared/supabase/messages";
export const getUserDataExport: APIHandler<'me/data'> = async (_, auth) => {
const userId = auth.uid
@@ -116,6 +117,7 @@ export const getUserDataExport: APIHandler<'me/data'> = async (_, auth) => {
[channelIds]
)
: []
for (const message of messages) parseMessageObject(message)
const membershipsWithUsernames = channelIds.length
? await pg.manyOrNone(

View File

@@ -22,10 +22,11 @@ export const convertPrivateChatMessage = (row: Row<'private_user_messages'>) =>
return message
}
type MessageObject = Omit<ChatMessage, "id"> & { id: number; createdTimeTs: string } & {
ciphertext: string;
iv: string;
tag: string
type MessageObject = {
ciphertext: string | null;
iv: string | null;
tag: string | null
content?: any
}
export function parseMessageObject(message: MessageObject) {