mirror of
https://github.com/hcengineering/platform.git
synced 2025-05-22 15:38:09 +00:00
Do not override sidebar with thread (#8277)
This commit is contained in:
parent
e1d479ab64
commit
d5b11c1ed3
@ -127,7 +127,7 @@
|
|||||||
const thread = loc.path[4] as Ref<ActivityMessage> | undefined
|
const thread = loc.path[4] as Ref<ActivityMessage> | undefined
|
||||||
|
|
||||||
if (thread !== undefined) {
|
if (thread !== undefined) {
|
||||||
void openThreadInSidebar(thread)
|
void openThreadInSidebar(thread, undefined, undefined, undefined, undefined, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,8 +339,23 @@ export async function openThreadInSidebar (
|
|||||||
msg?: ActivityMessage,
|
msg?: ActivityMessage,
|
||||||
doc?: Doc,
|
doc?: Doc,
|
||||||
selectedMessageId?: Ref<ActivityMessage>,
|
selectedMessageId?: Ref<ActivityMessage>,
|
||||||
props?: Record<string, any>
|
props?: Record<string, any>,
|
||||||
|
force: boolean = true
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
const sidebar = get(sidebarStore)
|
||||||
|
if (!force && sidebar.widget != null && sidebar.widget !== chunter.ids.ChatWidget) {
|
||||||
|
removeThreadFromLoc(_id)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const state = sidebar.widget === chunter.ids.ChatWidget ? sidebar.widgetsState.get(chunter.ids.ChatWidget) : undefined
|
||||||
|
const currentTabs = sidebar.widgetsState.get(chunter.ids.ChatWidget)?.tabs ?? []
|
||||||
|
const currentTab = state != null ? currentTabs.find((t) => t.id === state.tab) : undefined
|
||||||
|
|
||||||
|
if (!force && currentTab != null && (currentTab.isPinned === true || !currentTab.id.startsWith('thread_'))) {
|
||||||
|
removeThreadFromLoc(_id)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const client = getClient()
|
const client = getClient()
|
||||||
|
|
||||||
const widget = client.getModel().findAllSync(workbench.class.Widget, { _id: chunter.ids.ChatWidget })[0]
|
const widget = client.getModel().findAllSync(workbench.class.Widget, { _id: chunter.ids.ChatWidget })[0]
|
||||||
@ -362,7 +377,7 @@ export async function openThreadInSidebar (
|
|||||||
}
|
}
|
||||||
|
|
||||||
const allowedPath = loc.path.join('/')
|
const allowedPath = loc.path.join('/')
|
||||||
const currentTabs = get(sidebarStore).widgetsState.get(widget._id)?.tabs ?? []
|
|
||||||
const tabsToClose = currentTabs.filter((t) => t.isPinned !== true && t.allowedPath === allowedPath).map((t) => t.id)
|
const tabsToClose = currentTabs.filter((t) => t.isPinned !== true && t.allowedPath === allowedPath).map((t) => t.id)
|
||||||
|
|
||||||
if (tabsToClose.length > 0) {
|
if (tabsToClose.length > 0) {
|
||||||
|
@ -235,7 +235,8 @@ export default plugin(chunterId, {
|
|||||||
msg?: ActivityMessage,
|
msg?: ActivityMessage,
|
||||||
doc?: Doc,
|
doc?: Doc,
|
||||||
selectedId?: Ref<ActivityMessage>,
|
selectedId?: Ref<ActivityMessage>,
|
||||||
props?: Record<string, any>
|
props?: Record<string, any>,
|
||||||
|
force?: boolean
|
||||||
) => Promise<void>
|
) => Promise<void>
|
||||||
>,
|
>,
|
||||||
OpenChannelInSidebar: '' as Resource<
|
OpenChannelInSidebar: '' as Resource<
|
||||||
|
@ -192,7 +192,7 @@
|
|||||||
|
|
||||||
if (thread !== undefined) {
|
if (thread !== undefined) {
|
||||||
const fn = await getResource(chunter.function.OpenThreadInSidebar)
|
const fn = await getResource(chunter.function.OpenThreadInSidebar)
|
||||||
void fn(thread, undefined, undefined, selectedMessageId, { autofocus: false })
|
void fn(thread, undefined, undefined, selectedMessageId, { autofocus: false }, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedMessageId !== undefined) {
|
if (selectedMessageId !== undefined) {
|
||||||
|
@ -50,7 +50,7 @@ import notification, {
|
|||||||
type NotificationProviderSetting,
|
type NotificationProviderSetting,
|
||||||
type NotificationTypeSetting
|
type NotificationTypeSetting
|
||||||
} from '@hcengineering/notification'
|
} from '@hcengineering/notification'
|
||||||
import { getMetadata } from '@hcengineering/platform'
|
import { getMetadata, getResource } from '@hcengineering/platform'
|
||||||
import { MessageBox, createQuery, getClient } from '@hcengineering/presentation'
|
import { MessageBox, createQuery, getClient } from '@hcengineering/presentation'
|
||||||
import {
|
import {
|
||||||
getCurrentLocation,
|
getCurrentLocation,
|
||||||
@ -552,6 +552,8 @@ async function navigateToInboxDoc (
|
|||||||
if (thread !== undefined) {
|
if (thread !== undefined) {
|
||||||
loc.path[4] = thread
|
loc.path[4] = thread
|
||||||
loc.path.length = 5
|
loc.path.length = 5
|
||||||
|
const fn = await getResource(chunter.function.OpenThreadInSidebar)
|
||||||
|
void fn(thread, undefined, undefined, message, { autofocus: false })
|
||||||
} else {
|
} else {
|
||||||
loc.path[4] = ''
|
loc.path[4] = ''
|
||||||
loc.path.length = 4
|
loc.path.length = 4
|
||||||
|
Loading…
Reference in New Issue
Block a user