Skip to content

Add ability to enable camera in personal office #9190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common/scripts/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"0.7.136"
"0.7.139"
5 changes: 4 additions & 1 deletion models/love/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ export class TRoom extends TDoc implements Room {
@Index(IndexKind.FullText)
description!: MarkupBlobRef | null

type!: RoomType
@Prop(TypeAny(love.component.RoomTypePresenter, love.string.Video), love.string.Video, {
editor: love.component.RoomTypePresenter
})
type!: RoomType

access!: RoomAccess

Expand Down
11 changes: 11 additions & 0 deletions models/love/src/migration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,17 @@ export const loveOperation: MigrateOperation = {
func: async (client) => {
await client.reindex(DOMAIN_MEETING_MINUTES, [love.class.MeetingMinutes])
}
},
{
state: 'default-office-video',
mode: 'upgrade',
func: async (client) => {
await client.update(
DOMAIN_LOVE,
{ _class: love.class.Office, type: RoomType.Audio },
{ type: RoomType.Video }
)
}
}
])
},
Expand Down
2 changes: 1 addition & 1 deletion plugins/love-resources/src/components/AddRoomPopup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
{
id: 'office',
label: love.string.Office,
type: RoomType.Audio,
type: RoomType.Video,
_class: love.class.Office,
access: RoomAccess.Knock
}
Expand Down
5 changes: 3 additions & 2 deletions plugins/love-resources/src/components/EditRoom.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
// limitations under the License.
-->
<script lang="ts">
import { EditBox, ModernButton } from '@hcengineering/ui'
import { Room, isOffice, type ParticipantInfo } from '@hcengineering/love'
import { EditBox, Icon, ModernButton } from '@hcengineering/ui'
import { Room, isOffice, type ParticipantInfo, RoomType } from '@hcengineering/love'
import { createEventDispatcher, onMount } from 'svelte'
import { personByIdStore } from '@hcengineering/contact-resources'
import { IntlString } from '@hcengineering/platform'
Expand Down Expand Up @@ -95,6 +95,7 @@

<div class="flex-row-stretch">
<div class="row flex-grow">
<Icon icon={object.type === RoomType.Video ? love.icon.CamEnabled : love.icon.CamDisabled} size={'small'} />
<div class="name">
<EditBox disabled={true} placeholder={love.string.Room} bind:value={roomName} focusIndex={1} />
</div>
Expand Down
46 changes: 46 additions & 0 deletions plugins/love-resources/src/components/RoomTypePresenter.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<!--
// Copyright © 2025 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
-->
<script lang="ts">
import { Office, Room, RoomType } from '@hcengineering/love'
import { BooleanEditor } from '@hcengineering/view-resources'
import { getCurrentEmployee } from '@hcengineering/contact'
import type { ButtonKind, ButtonSize } from '@hcengineering/ui'

export let object: Room | undefined
export let value: RoomType | undefined
export let onChange: (value: any) => void
export let kind: ButtonKind = 'no-border'
export let size: ButtonSize = 'small'
export let justify: 'left' | 'center' = 'center'
export let width: string | undefined = 'fit-content'

$: booleanValue = value === RoomType.Video
$: disabled = object === undefined || !('person' in object) || (object as Office).person !== getCurrentEmployee()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so it will be enabled for me in my office, and disabled for me in any other office? why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So that users cannot turn on the camera in other people's offices. Should this be allowed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use isOffice func. It should be $: disabled = object === undefined || (isOffice(object) && object.person !== getCurrentEmployee())


function onValueChanged (newValue: any): void {
onChange(newValue === true ? RoomType.Video : RoomType.Audio)
}
</script>

<BooleanEditor
{disabled}
{kind}
{size}
{justify}
{width}
value={booleanValue}
withoutUndefined={true}
onChange={onValueChanged}
/>
4 changes: 3 additions & 1 deletion plugins/love-resources/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import MediaPopupItemExt from './components/MediaPopupItemExt.svelte'
import SharingStateIndicator from './components/SharingStateIndicator.svelte'
import MeetingScheduleData from './components/MeetingScheduleData.svelte'
import EditMeetingScheduleData from './components/EditMeetingScheduleData.svelte'
import RoomTypePresenter from './components/RoomTypePresenter.svelte'

import {
copyGuestLink,
Expand Down Expand Up @@ -71,7 +72,8 @@ export default async (): Promise<Resources> => ({
MediaPopupItemExt,
SharingStateIndicator,
MeetingScheduleData,
EditMeetingScheduleData
EditMeetingScheduleData,
RoomTypePresenter
},
function: {
CreateMeeting: createMeeting,
Expand Down
3 changes: 2 additions & 1 deletion plugins/love-resources/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export default mergeIds(loveId, love, {
MeetingMinutesDocEditor: '' as AnyComponent,
MeetingMinutesStatusPresenter: '' as AnyComponent,
MeetingScheduleData: '' as AnyComponent,
EditMeetingScheduleData: '' as AnyComponent
EditMeetingScheduleData: '' as AnyComponent,
RoomTypePresenter: '' as AnyComponent
},
function: {
CreateMeeting: '' as Resource<DocCreateFunction>,
Expand Down
2 changes: 1 addition & 1 deletion plugins/love-resources/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ async function connectLK (currentPerson: Person, room: Room): Promise<void> {
await connect(currentPerson.name, room, currentPerson._id)
await Promise.all([
setMic($myPreferences?.micEnabled ?? lk.remoteParticipants.size < 16),
setCam(room.type === RoomType.Video && ($myPreferences?.camEnabled ?? true))
setCam(room.type === RoomType.Video && !isOffice(room) && ($myPreferences?.camEnabled ?? true))
])
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/love/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function createDefaultRooms (employees: Ref<Employee>[]): (Data<Room | Of
const office: Data<Office> & { _id: Ref<Office> } = {
_id,
name: '',
type: RoomType.Audio,
type: RoomType.Video,
access: RoomAccess.Knock,
floor: love.ids.MainFloor,
width: 2,
Expand Down
Loading