UBERF-5020: fix reply to thread (#4502)

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
Kristina 2024-02-02 19:35:40 +04:00 committed by GitHub
parent c89eecc833
commit b114d142d8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 26 additions and 11 deletions

View File

@ -286,7 +286,6 @@ export function createModel (builder: Builder): void {
hidden: false, hidden: false,
// component: contact.component.ContactsTabs, // component: contact.component.ContactsTabs,
locationResolver: contact.resolver.Location, locationResolver: contact.resolver.Location,
aside: chunter.component.ThreadView,
navigatorModel: { navigatorModel: {
spaces: [], spaces: [],
specials: [ specials: [

View File

@ -148,7 +148,6 @@ export function createModel (builder: Builder): void {
icon: inventory.icon.InventoryApplication, icon: inventory.icon.InventoryApplication,
alias: inventoryId, alias: inventoryId,
hidden: false, hidden: false,
aside: chunter.component.ThreadView,
navigatorModel: { navigatorModel: {
specials: [ specials: [
{ {

View File

@ -155,7 +155,6 @@ export function createModel (builder: Builder): void {
icon: lead.icon.LeadApplication, icon: lead.icon.LeadApplication,
alias: leadId, alias: leadId,
hidden: false, hidden: false,
aside: chunter.component.ThreadView,
navigatorModel: { navigatorModel: {
specials: [ specials: [
{ {

View File

@ -302,7 +302,6 @@ export function createModel (builder: Builder): void {
locationResolver: recruit.resolver.Location, locationResolver: recruit.resolver.Location,
alias: recruitId, alias: recruitId,
hidden: false, hidden: false,
aside: chunter.component.ThreadView,
navigatorModel: { navigatorModel: {
spaces: [], spaces: [],
specials: [ specials: [

View File

@ -274,7 +274,6 @@ function defineApplication (
alias: trackerId, alias: trackerId,
hidden: false, hidden: false,
locationResolver: tracker.resolver.Location, locationResolver: tracker.resolver.Location,
aside: chunter.component.ThreadView,
navigatorModel: { navigatorModel: {
specials: [ specials: [
{ {

View File

@ -21,12 +21,19 @@ import chunter, {
chunterId, chunterId,
type DirectMessage type DirectMessage
} from '@hcengineering/chunter' } from '@hcengineering/chunter'
import { type Data, type Doc, type DocumentQuery, type Ref, type RelatedDocument } from '@hcengineering/core' import {
type Data,
type Doc,
type DocumentQuery,
getCurrentAccount,
type Ref,
type RelatedDocument
} from '@hcengineering/core'
import { type IntlString, type Resources, translate } from '@hcengineering/platform' import { type IntlString, type Resources, translate } from '@hcengineering/platform'
import { MessageBox, getClient } from '@hcengineering/presentation' import { MessageBox, getClient } from '@hcengineering/presentation'
import { closePanel, getCurrentLocation, getLocation, navigate, showPopup } from '@hcengineering/ui' import { closePanel, getCurrentLocation, getLocation, navigate, showPopup } from '@hcengineering/ui'
import activity, { type ActivityMessage, type DocUpdateMessage } from '@hcengineering/activity' import activity, { type ActivityMessage, type DocUpdateMessage } from '@hcengineering/activity'
import { type DocNotifyContext, inboxId } from '@hcengineering/notification' import notification, { type DocNotifyContext, inboxId } from '@hcengineering/notification'
import ChannelPresenter from './components/ChannelPresenter.svelte' import ChannelPresenter from './components/ChannelPresenter.svelte'
import ChannelView from './components/ChannelView.svelte' import ChannelView from './components/ChannelView.svelte'
@ -201,10 +208,23 @@ export async function deleteChatMessage (message: ChatMessage): Promise<void> {
export async function replyToThread (message: ActivityMessage): Promise<void> { export async function replyToThread (message: ActivityMessage): Promise<void> {
const loc = getCurrentLocation() const loc = getCurrentLocation()
const inboxClient = InboxNotificationsClientImpl.getClient() const client = getClient()
const context = get(inboxClient.docNotifyContextByDoc).get(message.attachedTo)
if (context === undefined) { const inboxClient = InboxNotificationsClientImpl.getClient()
let contextId: Ref<DocNotifyContext> | undefined = get(inboxClient.docNotifyContextByDoc).get(message.attachedTo)?._id
if (contextId === undefined) {
contextId = await client.createDoc(notification.class.DocNotifyContext, message.space, {
attachedTo: message.attachedTo,
attachedToClass: message.attachedToClass,
user: getCurrentAccount()._id,
hidden: false,
lastViewedTimestamp: Date.now()
})
}
if (contextId === undefined) {
return return
} }
@ -212,7 +232,7 @@ export async function replyToThread (message: ActivityMessage): Promise<void> {
loc.path[2] = chunterId loc.path[2] = chunterId
} }
navigateToThread(loc, context._id, message._id) navigateToThread(loc, contextId, message._id)
} }
export default async (): Promise<Resources> => ({ export default async (): Promise<Resources> => ({