mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-02-19 15:27:16 -05:00
Fix DM not parsed in data export
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user