Fix office meeting minutes (#7193)

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
Kristina 2024-11-19 10:20:16 +04:00 committed by GitHub
parent 46e0f217bf
commit d4394e8a2a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 3 deletions

View File

@ -1,6 +1,7 @@
import { Analytics } from '@hcengineering/analytics'
import calendar, { type Event, getAllEvents } from '@hcengineering/calendar'
import contact, { getName, type Person, type PersonAccount } from '@hcengineering/contact'
import { personByIdStore } from '@hcengineering/contact-resources'
import core, {
AccountRole,
concatLink,
@ -645,7 +646,7 @@ async function openMeetingMinutes (room: Room): Promise<void> {
attachedToClass: room._class,
collection: 'meetings',
space: core.space.Workspace,
title: `${room.name} ${date}`,
title: `${getRoomName(room, get(personByIdStore))} ${date}`,
description: makeCollaborativeDoc(_id, 'description'),
status: MeetingStatus.Active,
modifiedBy: getCurrentAccount()._id,

View File

@ -34,9 +34,11 @@ import love, {
loveId,
MeetingMinutes,
MeetingStatus,
Office,
ParticipantInfo,
RequestStatus,
RoomAccess
RoomAccess,
RoomInfo
} from '@hcengineering/love'
import notification from '@hcengineering/notification'
import { getMetadata, translate } from '@hcengineering/platform'
@ -241,6 +243,15 @@ async function setDefaultRoomAccess (info: ParticipantInfo, control: TriggerCont
return res
}
async function getRoomActivePersons (control: TriggerControl, roomInfo: RoomInfo): Promise<Ref<Person>[]> {
if (roomInfo.isOffice) {
const room = (await control.findAll(control.ctx, love.class.Office, { _id: roomInfo.room as Ref<Office> }))[0]
return roomInfo.persons.filter((p) => p !== room.person)
}
return roomInfo.persons
}
async function finishMeetingMinutes (
info: ParticipantInfo,
control: TriggerControl,
@ -254,7 +265,7 @@ async function finishMeetingMinutes (
return res
}
const currentPersons = roomInfo.persons.filter((p) => p !== info.person)
const currentPersons = (await getRoomActivePersons(control, roomInfo)).filter((p) => p !== info.person)
if (currentPersons.length === 0) {
const meetingMinutes = await control.findAll(control.ctx, love.class.MeetingMinutes, {