Skip to content

Commit a9b9690

Browse files
authored
Fix calendar migration (#8531)
Signed-off-by: Denis Bykhov <[email protected]>
1 parent fb8ce8a commit a9b9690

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

common/scripts/version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
"0.7.72"
1+
"0.7.75"

models/calendar/src/migration.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,8 @@ async function fillUser (client: MigrationClient): Promise<void> {
296296
const calendar = map.get(event.calendar)
297297
if (calendar !== undefined) {
298298
await client.update(
299-
DOMAIN_CALENDAR,
300-
{ _id: calendar._id },
299+
DOMAIN_EVENT,
300+
{ _id: event._id },
301301
{ user: event.createdBy !== core.account.System ? event.createdBy : calendar.createdBy }
302302
)
303303
}
@@ -360,7 +360,7 @@ export const calendarOperation: MigrateOperation = {
360360
func: migrateSocialIdsToAccountUuids
361361
},
362362
{
363-
state: 'fill-user',
363+
state: 'fill-user-v2',
364364
mode: 'upgrade',
365365
func: fillUser
366366
}

models/process/src/migration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ async function migrateStateFuncs (client: MigrationUpgradeClient): Promise<void>
7676
}
7777
}
7878
const endAction = state.endAction
79-
if (endAction != null) {
79+
if (endAction?.params != null) {
8080
for (const key of Object.keys(endAction.params)) {
8181
const value = (endAction.params as any)[key]
8282
const context = getContext(value)

server-plugins/calendar-resources/src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,12 +290,13 @@ async function eventForNewParticipants (
290290
if (socialStrings.includes(event.createdBy ?? event.modifiedBy)) continue
291291

292292
const primarySocialString = pickPrimarySocialId(socialIds)._id
293+
const user = primarySocialString
293294
const calendar = getCalendar(calendars, socialStrings)
294295
if (calendar === undefined) continue
295296
const innerTx = control.txFactory.createTxCreateDoc(
296297
_class,
297298
space,
298-
{ ...data, calendar, access },
299+
{ ...data, calendar, access, user },
299300
undefined,
300301
undefined,
301302
primarySocialString
@@ -363,12 +364,13 @@ async function onEventCreate (ctx: TxCreateDoc<Event>, control: TriggerControl):
363364
const socialStrings = socialIds.map((si) => si._id)
364365
if (socialStrings.includes(event.createdBy ?? event.modifiedBy)) continue
365366
const primarySocialString = pickPrimarySocialId(socialIds)._id
367+
const user = primarySocialString
366368
const calendar = getCalendar(calendars, socialStrings)
367369
if (calendar === undefined) continue
368370
const innerTx = control.txFactory.createTxCreateDoc(
369371
_class,
370372
space,
371-
{ ...data, calendar, access },
373+
{ ...data, calendar, access, user },
372374
undefined,
373375
undefined,
374376
primarySocialString

0 commit comments

Comments
 (0)