mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-28 04:25:03 +02:00
UBERF-9297: Fix space selection for emails (#8035)
Signed-off-by: Artem Savchenko <armisav@gmail.com>
This commit is contained in:
@@ -52,6 +52,9 @@ export function createModel (builder: Builder): void {
|
||||
label: mySpace.string.Mail,
|
||||
createLabel: mail.string.CreateMail,
|
||||
createComponent: mail.component.CreateMail
|
||||
},
|
||||
queryOptions: {
|
||||
filterBySpace: true
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
//
|
||||
-->
|
||||
<script lang="ts">
|
||||
import core, { Data, Doc, generateId, getCurrentAccount, Ref, Space } from '@hcengineering/core'
|
||||
import { Data, Doc, generateId, getCurrentAccount, Ref, Space } from '@hcengineering/core'
|
||||
import chunter, { type ChatMessage } from '@hcengineering/chunter'
|
||||
import { Card, getClient, isSpace } from '@hcengineering/presentation'
|
||||
import { MailThread } from '@hcengineering/mail'
|
||||
@@ -30,6 +30,7 @@
|
||||
const client = getClient()
|
||||
const account = getCurrentAccount()
|
||||
|
||||
export let space: Ref<Space>
|
||||
export let mailThreadId: Ref<MailThread> | undefined = undefined
|
||||
|
||||
export let to = ''
|
||||
@@ -84,7 +85,7 @@
|
||||
preview: getMessagePreview(message)
|
||||
}
|
||||
|
||||
const threadId = await client.createDoc(mail.class.MailThread, core.space.Space, data)
|
||||
const threadId = await client.createDoc(mail.class.MailThread, space, data)
|
||||
return await client.findOne(mail.class.MailThread, { _id: threadId as any })
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { Class, Doc, DocumentQuery, FindOptions, Ref, Space, WithLookup } from '@hcengineering/core'
|
||||
import { Class, Doc, DocumentQuery, FindOptions, Ref, Space, WithLookup, mergeQueries } from '@hcengineering/core'
|
||||
import { Asset, IntlString } from '@hcengineering/platform'
|
||||
import { getClient } from '@hcengineering/presentation'
|
||||
import {
|
||||
@@ -38,7 +38,7 @@
|
||||
ViewletSelector,
|
||||
ViewletSettingButton
|
||||
} from '@hcengineering/view-resources'
|
||||
import { ParentsNavigationModel } from '@hcengineering/workbench'
|
||||
import { QueryOptions, ParentsNavigationModel } from '@hcengineering/workbench'
|
||||
|
||||
import ComponentNavigator from './ComponentNavigator.svelte'
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
export let baseQuery: DocumentQuery<Doc> | undefined = undefined
|
||||
export let modes: IModeSelector<any> | undefined = undefined
|
||||
export let navigationModel: ParentsNavigationModel | undefined = undefined
|
||||
export let queryOptions: QueryOptions | undefined = undefined
|
||||
|
||||
const client = getClient()
|
||||
const hierarchy = client.getHierarchy()
|
||||
@@ -68,7 +69,8 @@
|
||||
let viewlets: Array<WithLookup<Viewlet>> = []
|
||||
let viewOptions: ViewOptions | undefined
|
||||
|
||||
$: _baseQuery = { ...(baseQuery ?? {}), ...(viewlet?.baseQuery ?? {}) }
|
||||
$: spaceQuery = queryOptions?.filterBySpace === true && space !== undefined ? { space } : {}
|
||||
$: _baseQuery = mergeQueries(mergeQueries(baseQuery ?? {}, viewlet?.baseQuery ?? {}), spaceQuery)
|
||||
$: query = { ..._baseQuery }
|
||||
$: searchQuery = search === '' ? query : { ...query, $search: search }
|
||||
$: resultQuery = searchQuery
|
||||
|
||||
@@ -996,7 +996,8 @@
|
||||
currentSpace,
|
||||
space: currentSpace,
|
||||
navigationModel: specialComponent?.navigationModel,
|
||||
workbenchWidth
|
||||
workbenchWidth,
|
||||
queryOptions: specialComponent?.queryOptions
|
||||
}}
|
||||
on:action={(e) => {
|
||||
if (e?.detail) {
|
||||
|
||||
@@ -184,6 +184,7 @@ export interface SpecialNavModel {
|
||||
(inboxNotificationsByContext: Map<Ref<DocNotifyContext>, InboxNotification[]>) => number
|
||||
>
|
||||
navigationModel?: ParentsNavigationModel
|
||||
queryOptions?: QueryOptions
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -202,6 +203,14 @@ export interface ParentsNavigationModel {
|
||||
createButton?: AnyComponent
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface QueryOptions {
|
||||
// If specified should display only documents from the current space
|
||||
filterBySpace?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user