Fast follows on new task/note behaviors (#6477)
In this PR, I'm fixing two issues that we have faced: - computing a rich text first line in case of the first block content is not a text - migrating existing timelineActivities tied to tasks / notes to linked-tasks / linked-notes during migration command
This commit is contained in:
@ -9,15 +9,21 @@ export const getFirstNonEmptyLineOfRichText = (
|
|||||||
}
|
}
|
||||||
for (const node of fieldValue) {
|
for (const node of fieldValue) {
|
||||||
if (!isUndefinedOrNull(node.content)) {
|
if (!isUndefinedOrNull(node.content)) {
|
||||||
const contentArray = node.content as Array<{ text: string }>;
|
const contentArray = node.content as Array<
|
||||||
|
{ text: string } | { link: string }
|
||||||
|
>;
|
||||||
if (contentArray.length > 0) {
|
if (contentArray.length > 0) {
|
||||||
for (const content of contentArray) {
|
for (const content of contentArray) {
|
||||||
if (content.text?.trim() !== '') {
|
if ('link' in content) {
|
||||||
return content.text;
|
return content.link;
|
||||||
|
}
|
||||||
|
if ('text' in content) {
|
||||||
|
return content.text.trim();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
};
|
};
|
||||||
|
|||||||
@ -165,11 +165,25 @@ export class UpdateActivitiesCommand extends CommandRunner {
|
|||||||
|
|
||||||
await timelineActivityRepository.update(
|
await timelineActivityRepository.update(
|
||||||
{
|
{
|
||||||
|
name: 'note.created',
|
||||||
linkedObjectMetadataId: activityObjectMetadataId,
|
linkedObjectMetadataId: activityObjectMetadataId,
|
||||||
linkedRecordId: activity.id,
|
linkedRecordId: activity.id,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
linkedObjectMetadataId: noteObjectMetadataId,
|
linkedObjectMetadataId: noteObjectMetadataId,
|
||||||
|
name: 'linked-note.created',
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
await timelineActivityRepository.update(
|
||||||
|
{
|
||||||
|
name: 'note.updated',
|
||||||
|
linkedObjectMetadataId: activityObjectMetadataId,
|
||||||
|
linkedRecordId: activity.id,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
linkedObjectMetadataId: noteObjectMetadataId,
|
||||||
|
name: 'linked-note.updated',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -214,11 +228,25 @@ export class UpdateActivitiesCommand extends CommandRunner {
|
|||||||
|
|
||||||
await timelineActivityRepository.update(
|
await timelineActivityRepository.update(
|
||||||
{
|
{
|
||||||
|
name: 'task.created',
|
||||||
linkedObjectMetadataId: activityObjectMetadataId,
|
linkedObjectMetadataId: activityObjectMetadataId,
|
||||||
linkedRecordId: activity.id,
|
linkedRecordId: activity.id,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
linkedObjectMetadataId: taskObjectMetadataId,
|
linkedObjectMetadataId: taskObjectMetadataId,
|
||||||
|
name: 'linked-task.created',
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
await timelineActivityRepository.update(
|
||||||
|
{
|
||||||
|
name: 'task.updated',
|
||||||
|
linkedObjectMetadataId: activityObjectMetadataId,
|
||||||
|
linkedRecordId: activity.id,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
linkedObjectMetadataId: taskObjectMetadataId,
|
||||||
|
name: 'linked-task.updated',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
await attachmentRepository.update(
|
await attachmentRepository.update(
|
||||||
|
|||||||
Reference in New Issue
Block a user