Fix navigation to inbox from cmd-k modal (#4900)

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
Kristina 2024-03-08 11:23:45 +04:00 committed by GitHub
parent 0abd2e39d5
commit a16e1ea231
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 23 additions and 30 deletions

View File

@ -54,7 +54,6 @@ import workbench from '@hcengineering/model-workbench'
import {
type DocUpdates,
type DocUpdateTx,
inboxId,
type InboxNotification,
type DocNotifyContext,
type Notification,
@ -66,14 +65,14 @@ import {
type NotificationStatus,
type NotificationTemplate,
type NotificationType,
notificationId,
type NotificationObjectPresenter,
type ActivityInboxNotification,
type CommonInboxNotification,
type NotificationContextPresenter,
type ActivityNotificationViewlet,
type BaseNotificationType,
type CommonNotificationType
type CommonNotificationType,
notificationId
} from '@hcengineering/notification'
import { type Asset, type IntlString } from '@hcengineering/platform'
import setting from '@hcengineering/setting'
@ -348,7 +347,7 @@ export function createModel (builder: Builder): void {
{
label: notification.string.Inbox,
icon: notification.icon.Inbox,
alias: inboxId,
alias: notificationId,
hidden: true,
locationResolver: notification.resolver.Location,
component: notification.component.Inbox,
@ -361,8 +360,7 @@ export function createModel (builder: Builder): void {
action: workbench.actionImpl.Navigate,
actionProps: {
mode: 'app',
application: notificationId,
special: notificationId
application: notificationId
},
label: notification.string.Inbox,
icon: view.icon.ArrowRight,

View File

@ -20,7 +20,7 @@ import { type Resources } from '@hcengineering/platform'
import { MessageBox, getClient } from '@hcengineering/presentation'
import { closePanel, getCurrentLocation, getLocation, navigate, showPopup } from '@hcengineering/ui'
import { type ActivityMessage } from '@hcengineering/activity'
import notification, { type DocNotifyContext, inboxId } from '@hcengineering/notification'
import notification, { type DocNotifyContext, notificationId } from '@hcengineering/notification'
import ChannelPresenter from './components/ChannelPresenter.svelte'
import ChannelView from './components/ChannelView.svelte'
@ -201,7 +201,7 @@ export async function replyToThread (message: ActivityMessage): Promise<void> {
return
}
if (loc.path[2] !== inboxId) {
if (loc.path[2] !== notificationId) {
loc.path[2] = chunterId
}

View File

@ -53,7 +53,7 @@ import activity, {
type DocUpdateMessage
} from '@hcengineering/activity'
import { InboxNotificationsClientImpl } from '@hcengineering/notification-resources'
import notification, { type DocNotifyContext, inboxId } from '@hcengineering/notification'
import notification, { type DocNotifyContext, notificationId } from '@hcengineering/notification'
import { get, type Unsubscriber } from 'svelte/store'
import chunter from './plugin'
@ -396,7 +396,7 @@ export function buildThreadLink (loc: Location, contextId: Ref<DocNotifyContext>
return loc
}
if (loc.path[2] !== inboxId) {
if (loc.path[2] !== notificationId) {
loc.path[2] = chunterId
}

View File

@ -30,7 +30,7 @@ import {
type WithLookup
} from '@hcengineering/core'
import notification, {
inboxId,
notificationId,
type ActivityInboxNotification,
type Collaborators,
type DisplayActivityInboxNotification,
@ -515,7 +515,7 @@ export async function getNotificationsCount (
}
export async function resolveLocation (loc: Location): Promise<ResolvedLocation | undefined> {
if (loc.path[2] !== inboxId) {
if (loc.path[2] !== notificationId) {
return undefined
}
@ -524,11 +524,11 @@ export async function resolveLocation (loc: Location): Promise<ResolvedLocation
if (contextId === undefined) {
return {
loc: {
path: [loc.path[0], loc.path[1], inboxId],
path: [loc.path[0], loc.path[1], notificationId],
fragment: undefined
},
defaultLocation: {
path: [loc.path[0], loc.path[1], inboxId],
path: [loc.path[0], loc.path[1], notificationId],
fragment: undefined
}
}
@ -555,11 +555,11 @@ async function generateLocation (
if (contextNotification === undefined) {
return {
loc: {
path: [loc.path[0], loc.path[1], inboxId],
path: [loc.path[0], loc.path[1], notificationId],
fragment: undefined
},
defaultLocation: {
path: [loc.path[0], loc.path[1], inboxId],
path: [loc.path[0], loc.path[1], notificationId],
fragment: undefined
}
}
@ -573,12 +573,12 @@ async function generateLocation (
if (thread === undefined) {
return {
loc: {
path: [appComponent, workspace, inboxId, contextId],
path: [appComponent, workspace, notificationId, contextId],
fragment: undefined,
query: { ...loc.query, message: message !== undefined ? (messageId as string) : null }
},
defaultLocation: {
path: [appComponent, workspace, inboxId, contextId],
path: [appComponent, workspace, notificationId, contextId],
fragment: undefined,
query: { ...loc.query, message: message !== undefined ? (messageId as string) : null }
}
@ -587,12 +587,12 @@ async function generateLocation (
return {
loc: {
path: [appComponent, workspace, inboxId, contextId, threadId as string],
path: [appComponent, workspace, notificationId, contextId, threadId as string],
fragment: undefined,
query: { ...loc.query, message: message !== undefined ? (messageId as string) : null }
},
defaultLocation: {
path: [appComponent, workspace, inboxId, contextId, threadId as string],
path: [appComponent, workspace, notificationId, contextId, threadId as string],
fragment: undefined,
query: { ...loc.query, message: message !== undefined ? (messageId as string) : null }
}
@ -606,7 +606,7 @@ export function openInboxDoc (
): void {
const loc = getLocation()
if (loc.path[2] !== inboxId) {
if (loc.path[2] !== notificationId) {
return
}

View File

@ -201,11 +201,6 @@ export interface DocUpdates extends Doc {
*/
export const notificationId = 'notification' as Plugin
/**
* @public
*/
export const inboxId = 'inbox' as Plugin
/**
* @public
*/

View File

@ -17,7 +17,7 @@
import contact, { Employee, PersonAccount } from '@hcengineering/contact'
import core, { AccountRole, Class, Doc, Ref, Space, getCurrentAccount } from '@hcengineering/core'
import login from '@hcengineering/login'
import notification, { DocNotifyContext, InboxNotification, inboxId } from '@hcengineering/notification'
import notification, { DocNotifyContext, InboxNotification, notificationId } from '@hcengineering/notification'
import { BrowserNotificatator, InboxNotificationsClientImpl } from '@hcengineering/notification-resources'
import { IntlString, broadcastEvent, getMetadata, getResource } from '@hcengineering/platform'
import { ActionContext, createQuery, getClient, isAdminUser } from '@hcengineering/presentation'
@ -687,14 +687,14 @@
/>
</div>
<!-- <ActivityStatus status="active" /> -->
<NavLink app={inboxId} shrink={0}>
<NavLink app={notificationId} shrink={0}>
<AppItem
icon={notification.icon.Notifications}
label={notification.string.Inbox}
selected={currentAppAlias === inboxId || inboxPopup !== undefined}
selected={currentAppAlias === notificationId || inboxPopup !== undefined}
on:click={(e) => {
if (e.metaKey || e.ctrlKey) return
if (currentAppAlias === inboxId && lastLoc !== undefined) {
if (currentAppAlias === notificationId && lastLoc !== undefined) {
e.preventDefault()
e.stopPropagation()
navigate(lastLoc)