[messaging] Rename body to text (#3595)
* Store HTML message * remove console log * [messaging] rename body to text * use CoreObjectNameSingular
This commit is contained in:
@ -5,6 +5,7 @@ import { ThreadPreview } from '@/activities/emails/components/ThreadPreview';
|
|||||||
import { getTimelineThreadsFromCompanyId } from '@/activities/emails/queries/getTimelineThreadsFromCompanyId';
|
import { getTimelineThreadsFromCompanyId } from '@/activities/emails/queries/getTimelineThreadsFromCompanyId';
|
||||||
import { getTimelineThreadsFromPersonId } from '@/activities/emails/queries/getTimelineThreadsFromPersonId';
|
import { getTimelineThreadsFromPersonId } from '@/activities/emails/queries/getTimelineThreadsFromPersonId';
|
||||||
import { ActivityTargetableObject } from '@/activities/types/ActivityTargetableEntity';
|
import { ActivityTargetableObject } from '@/activities/types/ActivityTargetableEntity';
|
||||||
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
import {
|
import {
|
||||||
H1Title,
|
H1Title,
|
||||||
H1TitleFontColor,
|
H1TitleFontColor,
|
||||||
@ -31,12 +32,12 @@ const StyledEmailCount = styled.span`
|
|||||||
|
|
||||||
export const Threads = ({ entity }: { entity: ActivityTargetableObject }) => {
|
export const Threads = ({ entity }: { entity: ActivityTargetableObject }) => {
|
||||||
const threadQuery =
|
const threadQuery =
|
||||||
entity.targetObjectNameSingular === 'person'
|
entity.targetObjectNameSingular === CoreObjectNameSingular.Person
|
||||||
? getTimelineThreadsFromPersonId
|
? getTimelineThreadsFromPersonId
|
||||||
: getTimelineThreadsFromCompanyId;
|
: getTimelineThreadsFromCompanyId;
|
||||||
|
|
||||||
const threadQueryVariables =
|
const threadQueryVariables =
|
||||||
entity.targetObjectNameSingular === 'person'
|
entity.targetObjectNameSingular === CoreObjectNameSingular.Person
|
||||||
? { personId: entity.id }
|
? { personId: entity.id }
|
||||||
: { companyId: entity.id };
|
: { companyId: entity.id };
|
||||||
|
|
||||||
@ -50,7 +51,7 @@ export const Threads = ({ entity }: { entity: ActivityTargetableObject }) => {
|
|||||||
|
|
||||||
const timelineThreads: TimelineThread[] =
|
const timelineThreads: TimelineThread[] =
|
||||||
threads.data[
|
threads.data[
|
||||||
entity.targetObjectNameSingular === 'Person'
|
entity.targetObjectNameSingular === CoreObjectNameSingular.Person
|
||||||
? 'getTimelineThreadsFromPersonId'
|
? 'getTimelineThreadsFromPersonId'
|
||||||
: 'getTimelineThreadsFromCompanyId'
|
: 'getTimelineThreadsFromCompanyId'
|
||||||
];
|
];
|
||||||
|
|||||||
@ -30,7 +30,7 @@ export class TimelineMessagingService {
|
|||||||
subquery.*,
|
subquery.*,
|
||||||
message_count,
|
message_count,
|
||||||
last_message_subject,
|
last_message_subject,
|
||||||
last_message_body,
|
last_message_text,
|
||||||
last_message_received_at,
|
last_message_received_at,
|
||||||
last_message_participant_handle,
|
last_message_participant_handle,
|
||||||
last_message_participant_displayName
|
last_message_participant_displayName
|
||||||
@ -39,7 +39,7 @@ export class TimelineMessagingService {
|
|||||||
mt.*,
|
mt.*,
|
||||||
COUNT(m."id") OVER (PARTITION BY mt."id") AS message_count,
|
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."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(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."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,
|
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: '',
|
senderPictureUrl: '',
|
||||||
numberOfMessagesInThread: messageThread.message_count,
|
numberOfMessagesInThread: messageThread.message_count,
|
||||||
subject: messageThread.last_message_subject,
|
subject: messageThread.last_message_subject,
|
||||||
body: messageThread.last_message_body,
|
body: messageThread.last_message_text,
|
||||||
receivedAt: messageThread.last_message_received_at,
|
receivedAt: messageThread.last_message_received_at,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@ -91,7 +91,7 @@ export class MessagingUtilsService {
|
|||||||
const receivedAt = new Date(parseInt(message.internalDate));
|
const receivedAt = new Date(parseInt(message.internalDate));
|
||||||
|
|
||||||
await manager.query(
|
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,
|
newMessageId,
|
||||||
message.headerMessageId,
|
message.headerMessageId,
|
||||||
|
|||||||
@ -64,11 +64,11 @@ export class MessageObjectMetadata extends BaseObjectMetadata {
|
|||||||
|
|
||||||
@FieldMetadata({
|
@FieldMetadata({
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Body',
|
label: 'Text',
|
||||||
description: 'Body',
|
description: 'Text',
|
||||||
icon: 'IconMessage',
|
icon: 'IconMessage',
|
||||||
})
|
})
|
||||||
body: string;
|
text: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@FieldMetadata({
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
|
|||||||
Reference in New Issue
Block a user