mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-24 20:42:05 +03:00
[messaging] Rename body to text (#3595)
* Store HTML message * remove console log * [messaging] rename body to text * use CoreObjectNameSingular
This commit is contained in:
parent
c0c2906209
commit
c7ad6a0de7
@ -5,6 +5,7 @@ import { ThreadPreview } from '@/activities/emails/components/ThreadPreview';
|
||||
import { getTimelineThreadsFromCompanyId } from '@/activities/emails/queries/getTimelineThreadsFromCompanyId';
|
||||
import { getTimelineThreadsFromPersonId } from '@/activities/emails/queries/getTimelineThreadsFromPersonId';
|
||||
import { ActivityTargetableObject } from '@/activities/types/ActivityTargetableEntity';
|
||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||
import {
|
||||
H1Title,
|
||||
H1TitleFontColor,
|
||||
@ -31,12 +32,12 @@ const StyledEmailCount = styled.span`
|
||||
|
||||
export const Threads = ({ entity }: { entity: ActivityTargetableObject }) => {
|
||||
const threadQuery =
|
||||
entity.targetObjectNameSingular === 'person'
|
||||
entity.targetObjectNameSingular === CoreObjectNameSingular.Person
|
||||
? getTimelineThreadsFromPersonId
|
||||
: getTimelineThreadsFromCompanyId;
|
||||
|
||||
const threadQueryVariables =
|
||||
entity.targetObjectNameSingular === 'person'
|
||||
entity.targetObjectNameSingular === CoreObjectNameSingular.Person
|
||||
? { personId: entity.id }
|
||||
: { companyId: entity.id };
|
||||
|
||||
@ -50,7 +51,7 @@ export const Threads = ({ entity }: { entity: ActivityTargetableObject }) => {
|
||||
|
||||
const timelineThreads: TimelineThread[] =
|
||||
threads.data[
|
||||
entity.targetObjectNameSingular === 'Person'
|
||||
entity.targetObjectNameSingular === CoreObjectNameSingular.Person
|
||||
? 'getTimelineThreadsFromPersonId'
|
||||
: 'getTimelineThreadsFromCompanyId'
|
||||
];
|
||||
|
@ -30,7 +30,7 @@ export class TimelineMessagingService {
|
||||
subquery.*,
|
||||
message_count,
|
||||
last_message_subject,
|
||||
last_message_body,
|
||||
last_message_text,
|
||||
last_message_received_at,
|
||||
last_message_participant_handle,
|
||||
last_message_participant_displayName
|
||||
@ -39,7 +39,7 @@ export class TimelineMessagingService {
|
||||
mt.*,
|
||||
COUNT(m."id") OVER (PARTITION BY mt."id") AS message_count,
|
||||
FIRST_VALUE(m."subject") OVER (PARTITION BY mt."id" ORDER BY m."receivedAt" DESC) AS last_message_subject,
|
||||
FIRST_VALUE(m."body") OVER (PARTITION BY mt."id" ORDER BY m."receivedAt" DESC) AS last_message_body,
|
||||
FIRST_VALUE(m."text") OVER (PARTITION BY mt."id" ORDER BY m."receivedAt" DESC) AS last_message_text,
|
||||
FIRST_VALUE(m."receivedAt") OVER (PARTITION BY mt."id" ORDER BY m."receivedAt" DESC) AS last_message_received_at,
|
||||
FIRST_VALUE(mr."handle") OVER (PARTITION BY mt."id" ORDER BY m."receivedAt" DESC) AS last_message_participant_handle,
|
||||
FIRST_VALUE(mr."displayName") OVER (PARTITION BY mt."id" ORDER BY m."receivedAt" DESC) AS last_message_participant_displayName,
|
||||
@ -69,7 +69,7 @@ export class TimelineMessagingService {
|
||||
senderPictureUrl: '',
|
||||
numberOfMessagesInThread: messageThread.message_count,
|
||||
subject: messageThread.last_message_subject,
|
||||
body: messageThread.last_message_body,
|
||||
body: messageThread.last_message_text,
|
||||
receivedAt: messageThread.last_message_received_at,
|
||||
};
|
||||
});
|
||||
|
@ -91,7 +91,7 @@ export class MessagingUtilsService {
|
||||
const receivedAt = new Date(parseInt(message.internalDate));
|
||||
|
||||
await manager.query(
|
||||
`INSERT INTO ${dataSourceMetadata.schema}."message" ("id", "headerMessageId", "subject", "receivedAt", "direction", "messageThreadId", "body", "html") VALUES ($1, $2, $3, $4, $5, $6, $7, $8)`,
|
||||
`INSERT INTO ${dataSourceMetadata.schema}."message" ("id", "headerMessageId", "subject", "receivedAt", "direction", "messageThreadId", "text", "html") VALUES ($1, $2, $3, $4, $5, $6, $7, $8)`,
|
||||
[
|
||||
newMessageId,
|
||||
message.headerMessageId,
|
||||
|
@ -64,11 +64,11 @@ export class MessageObjectMetadata extends BaseObjectMetadata {
|
||||
|
||||
@FieldMetadata({
|
||||
type: FieldMetadataType.TEXT,
|
||||
label: 'Body',
|
||||
description: 'Body',
|
||||
label: 'Text',
|
||||
description: 'Text',
|
||||
icon: 'IconMessage',
|
||||
})
|
||||
body: string;
|
||||
text: string;
|
||||
|
||||
@FieldMetadata({
|
||||
type: FieldMetadataType.TEXT,
|
||||
|
Loading…
Reference in New Issue
Block a user