diff --git a/models/chunter/src/migration.ts b/models/chunter/src/migration.ts index 7c6fff55c2..3a64bfa738 100644 --- a/models/chunter/src/migration.ts +++ b/models/chunter/src/migration.ts @@ -137,7 +137,7 @@ export async function migrateThreadMessages (client: MigrationClient): Promise }) } @@ -156,7 +156,7 @@ export async function migrateThreadMessages (client: MigrationClient): Promise { ) { continue } + + await client.update(domain, { createOn: { $exists: true } }, { $unset: { createOn: 1 } }) + while (true) { try { const objects = await client.find( @@ -115,7 +118,7 @@ async function fillCreatedOn (client: MigrationClient): Promise { _class: core.class.TxCreateDoc, objectId: { $in: Array.from(objects.map((it) => it._id)) } }, - { projection: { _id: 1, modifiedOn: 1, createOn: 1, objectId: 1 } } + { projection: { _id: 1, modifiedOn: 1, createdOn: 1, objectId: 1 } } ) const txes2 = ( @@ -126,13 +129,13 @@ async function fillCreatedOn (client: MigrationClient): Promise { 'tx._class': core.class.TxCreateDoc, 'tx.objectId': { $in: Array.from(objects.map((it) => it._id)) } }, - { projection: { _id: 1, modifiedOn: 1, createOn: 1, tx: 1 } } + { projection: { _id: 1, modifiedOn: 1, createdOn: 1, tx: 1 } } ) ).map((it) => it.tx as unknown as TxCreateDoc) const txMap = new Map(txes.concat(txes2).map((p) => [p.objectId, p])) - console.log('migrateCreateOn', domain, objects.length) + console.log('migratecreatedOn', domain, objects.length) await client.bulk( domain, objects.map((it) => { @@ -140,7 +143,7 @@ async function fillCreatedOn (client: MigrationClient): Promise { return { filter: { _id: it._id }, update: { - createdOn: createTx?.createOn ?? it.modifiedOn + createdOn: createTx?.createdOn ?? it.modifiedOn } } }) diff --git a/models/lead/src/index.ts b/models/lead/src/index.ts index 9ef793800b..8c80f5a514 100644 --- a/models/lead/src/index.ts +++ b/models/lead/src/index.ts @@ -263,7 +263,7 @@ export function createModel (builder: Builder): void { orderBy: [ ['state', SortingOrder.Ascending], ['modifiedOn', SortingOrder.Descending], - ['createOn', SortingOrder.Descending], + ['createdOn', SortingOrder.Descending], ['dueDate', SortingOrder.Ascending], ['rank', SortingOrder.Ascending] ], diff --git a/models/recruit/src/index.ts b/models/recruit/src/index.ts index 8d2027b530..5ff71f5809 100644 --- a/models/recruit/src/index.ts +++ b/models/recruit/src/index.ts @@ -624,7 +624,7 @@ export function createModel (builder: Builder): void { orderBy: [ ['state', SortingOrder.Ascending], ['modifiedOn', SortingOrder.Descending], - ['createOn', SortingOrder.Descending], + ['createdOn', SortingOrder.Descending], ['dueDate', SortingOrder.Ascending], ['rank', SortingOrder.Ascending] ], diff --git a/models/tracker/src/index.ts b/models/tracker/src/index.ts index 4e1c13ef9d..f7c894b7da 100644 --- a/models/tracker/src/index.ts +++ b/models/tracker/src/index.ts @@ -463,7 +463,7 @@ export function createModel (builder: Builder): void { ['status', SortingOrder.Ascending], ['priority', SortingOrder.Ascending], ['modifiedOn', SortingOrder.Descending], - ['createOn', SortingOrder.Descending], + ['createdOn', SortingOrder.Descending], ['dueDate', SortingOrder.Ascending], ['rank', SortingOrder.Ascending] ], @@ -592,7 +592,7 @@ export function createModel (builder: Builder): void { ['status', SortingOrder.Ascending], ['priority', SortingOrder.Ascending], ['modifiedOn', SortingOrder.Descending], - ['createOn', SortingOrder.Descending], + ['createdOn', SortingOrder.Descending], ['dueDate', SortingOrder.Ascending] ], groupDepth: 1, @@ -1780,7 +1780,7 @@ export function createModel (builder: Builder): void { orderBy: [ ['modifiedOn', SortingOrder.Descending], ['targetDate', SortingOrder.Descending], - ['createOn', SortingOrder.Descending] + ['createdOn', SortingOrder.Descending] ], other: [showColors] } @@ -1852,7 +1852,7 @@ export function createModel (builder: Builder): void { groupBy: ['lead'], orderBy: [ ['modifiedOn', SortingOrder.Descending], - ['createOn', SortingOrder.Descending] + ['createdOn', SortingOrder.Descending] ], other: [showColors] } diff --git a/models/view/src/migration.ts b/models/view/src/migration.ts index c64165165f..ea6e0e174f 100644 --- a/models/view/src/migration.ts +++ b/models/view/src/migration.ts @@ -59,13 +59,17 @@ async function migrateViewletPreference (client: MigrationClient): Promise } async function migrateSavedFilters (client: MigrationClient): Promise { - await client.move( - DOMAIN_PREFERENCE, - { - _class: view.class.FilteredView - }, - DOMAIN_VIEW - ) + try { + await client.move( + DOMAIN_PREFERENCE, + { + _class: view.class.FilteredView + }, + DOMAIN_VIEW + ) + } catch (err: any) { + console.log(err) + } const preferences = await client.find(DOMAIN_VIEW, { _class: view.class.FilteredView, users: { $exists: false } diff --git a/packages/core/src/classes.ts b/packages/core/src/classes.ts index 165a445b41..9cfdd1803e 100644 --- a/packages/core/src/classes.ts +++ b/packages/core/src/classes.ts @@ -57,7 +57,7 @@ export interface Doc extends Obj { modifiedOn: Timestamp modifiedBy: Ref createdBy?: Ref // Marked as optional since it will be filled by platform. - createOn?: Timestamp // Marked as optional since it will be filled by platform. + createdOn?: Timestamp // Marked as optional since it will be filled by platform. } /** diff --git a/packages/core/src/tx.ts b/packages/core/src/tx.ts index 18655c6902..d351e853d2 100644 --- a/packages/core/src/tx.ts +++ b/packages/core/src/tx.ts @@ -354,7 +354,7 @@ export abstract class TxProcessor implements WithTx { modifiedBy: tx.modifiedBy, modifiedOn: tx.modifiedOn, createdBy: tx.createdBy ?? tx.modifiedBy, - createOn: tx.createOn ?? tx.modifiedOn + createdOn: tx.createdOn ?? tx.modifiedOn } as T } diff --git a/plugins/chunter-resources/src/components/Channel.svelte b/plugins/chunter-resources/src/components/Channel.svelte index 6f6fa9dc67..24885ba120 100644 --- a/plugins/chunter-resources/src/components/Channel.svelte +++ b/plugins/chunter-resources/src/components/Channel.svelte @@ -109,7 +109,7 @@ if (docUpdate === undefined || lastView === undefined) return -1 for (let index = 0; index < messages.length; index++) { const message = messages[index] - if ((message.createOn ?? 0) >= lastView) return index + if ((message.createdOn ?? 0) >= lastView) return index } return -1 } @@ -209,8 +209,8 @@ {#if newMessagesPos === i} {/if} - {#if i === 0 || isOtherDay(message.createOn ?? 0, messages[i - 1].createOn ?? 0)} - + {#if i === 0 || isOtherDay(message.createdOn ?? 0, messages[i - 1].createdOn ?? 0)} + {/if} {/if} - {getTime(message.createOn ?? 0)} + {getTime(message.createdOn ?? 0)} {#if message.editedOn}