From d4394e8a2a4460bab02059d9db4846095847d596 Mon Sep 17 00:00:00 2001 From: Kristina <kristin.fefelova@gmail.com> Date: Tue, 19 Nov 2024 10:20:16 +0400 Subject: [PATCH] Fix office meeting minutes (#7193) Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com> --- plugins/love-resources/src/utils.ts | 3 ++- server-plugins/love-resources/src/index.ts | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/plugins/love-resources/src/utils.ts b/plugins/love-resources/src/utils.ts index c44b8b300e..8b23e9cc39 100644 --- a/plugins/love-resources/src/utils.ts +++ b/plugins/love-resources/src/utils.ts @@ -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, diff --git a/server-plugins/love-resources/src/index.ts b/server-plugins/love-resources/src/index.ts index 3eea7fa794..f9eb5305cc 100644 --- a/server-plugins/love-resources/src/index.ts +++ b/server-plugins/love-resources/src/index.ts @@ -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, {