mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-12 04:37:44 +02:00
Add blockTime property to calendar events (#9275)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
@@ -1 +1 @@
|
||||
"0.7.136"
|
||||
"0.7.145"
|
||||
|
||||
@@ -140,6 +140,8 @@ export class TEvent extends TAttachedDoc implements Event {
|
||||
timeZone?: string
|
||||
|
||||
user!: PersonId
|
||||
|
||||
blockTime!: boolean
|
||||
}
|
||||
|
||||
@Model(calendar.class.ReccuringEvent, calendar.class.Event)
|
||||
|
||||
@@ -295,6 +295,11 @@ async function fillUser (client: MigrationClient): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
async function fillBlockTime (client: MigrationClient): Promise<void> {
|
||||
await client.update(DOMAIN_EVENT, { blockTime: { $exists: false }, allDay: true }, { blockTime: false })
|
||||
await client.update(DOMAIN_EVENT, { blockTime: { $exists: false } }, { blockTime: true })
|
||||
}
|
||||
|
||||
async function migrateTimezone (client: MigrationClient): Promise<void> {
|
||||
await client.update(
|
||||
DOMAIN_CALENDAR,
|
||||
@@ -354,6 +359,11 @@ export const calendarOperation: MigrateOperation = {
|
||||
state: 'fill-user-v2',
|
||||
mode: 'upgrade',
|
||||
func: fillUser
|
||||
},
|
||||
{
|
||||
state: 'fill-block-time',
|
||||
mode: 'upgrade',
|
||||
func: fillBlockTime
|
||||
}
|
||||
])
|
||||
},
|
||||
|
||||
@@ -262,6 +262,7 @@
|
||||
collection: 'events',
|
||||
calendar: `${acc.uuid}_calendar` as Ref<Calendar>,
|
||||
modifiedBy: myPrimaryId,
|
||||
blockTime: true,
|
||||
participants: [me],
|
||||
modifiedOn: Date.now(),
|
||||
date: e.detail.date.getTime(),
|
||||
|
||||
@@ -136,6 +136,7 @@
|
||||
visibility,
|
||||
title,
|
||||
location,
|
||||
blockTime: !allDay,
|
||||
allDay,
|
||||
access: 'owner',
|
||||
originalStartTime: allDay ? saveUTC(date) : date,
|
||||
@@ -163,6 +164,7 @@
|
||||
reminders,
|
||||
title,
|
||||
location,
|
||||
blockTime: !allDay,
|
||||
allDay,
|
||||
timeZone,
|
||||
access: 'owner',
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
participants,
|
||||
title: _title,
|
||||
allDay: false,
|
||||
blockTime: false,
|
||||
reminders: [0],
|
||||
access: 'owner',
|
||||
user: getCurrentAccount().primarySocialId
|
||||
|
||||
@@ -108,7 +108,8 @@ async function deleteRecHandler (res: any, object: ReccuringInstance): Promise<v
|
||||
visibility: object.visibility,
|
||||
access: object.access,
|
||||
timeZone: object.timeZone,
|
||||
user: object.user
|
||||
user: object.user,
|
||||
blockTime: object.blockTime
|
||||
},
|
||||
object._id
|
||||
)
|
||||
|
||||
@@ -169,6 +169,7 @@ export async function updateReccuringInstance (
|
||||
rdate: object.rdate,
|
||||
timeZone: object.timeZone,
|
||||
user: object.user,
|
||||
blockTime: object.blockTime,
|
||||
...ops
|
||||
},
|
||||
object._id
|
||||
|
||||
@@ -121,6 +121,8 @@ export interface Event extends AttachedDoc {
|
||||
timeZone?: string
|
||||
|
||||
user: PersonId
|
||||
|
||||
blockTime: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -97,6 +97,7 @@
|
||||
description: todo.description,
|
||||
participants: [me],
|
||||
calendar: _calendar,
|
||||
blockTime: true,
|
||||
title: todo.title,
|
||||
allDay: false,
|
||||
access: 'owner',
|
||||
@@ -149,6 +150,7 @@
|
||||
participants: [me],
|
||||
title: todo.title,
|
||||
allDay: false,
|
||||
blockTime: true,
|
||||
access: 'owner',
|
||||
visibility: todo.visibility,
|
||||
reminders: [],
|
||||
|
||||
@@ -65,6 +65,7 @@
|
||||
participants: [getCurrentEmployee()],
|
||||
title: doc.title,
|
||||
allDay: false,
|
||||
blockTime: true,
|
||||
access: 'owner',
|
||||
visibility: doc.visibility === 'public' ? 'public' : 'freeBusy',
|
||||
reminders: [],
|
||||
|
||||
@@ -127,6 +127,7 @@
|
||||
_class: time.class.WorkSlot,
|
||||
collection: 'events',
|
||||
visibility: 'public',
|
||||
blockTime: true,
|
||||
calendar: _calendar,
|
||||
space: calendar.space.Calendar,
|
||||
modifiedBy: myAcc.primarySocialId,
|
||||
|
||||
@@ -71,6 +71,7 @@
|
||||
description: todo.description,
|
||||
participants: [getCurrentEmployee()],
|
||||
title: todo.title,
|
||||
blockTime: true,
|
||||
allDay: false,
|
||||
access: 'owner',
|
||||
user: currentAccount.primarySocialId,
|
||||
|
||||
@@ -364,7 +364,8 @@ export class IncomingSyncManager {
|
||||
calendar: _calendar,
|
||||
access: this.getAccess(event, accessRole),
|
||||
timeZone: event.start?.timeZone ?? event.end?.timeZone ?? 'Etc/GMT',
|
||||
user: this.user.userId
|
||||
user: this.user.userId,
|
||||
blockTime: event.transparency !== 'transparent'
|
||||
}
|
||||
if (participants[1].length > 0) {
|
||||
res.externalParticipants = participants[1]
|
||||
@@ -463,6 +464,9 @@ export class IncomingSyncManager {
|
||||
? 'public'
|
||||
: (event.extendedProperties?.private?.visibility as Visibility) ?? 'private'
|
||||
}
|
||||
if (event.transparency != null) {
|
||||
res.blockTime = event.transparency !== 'transparent'
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user