mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-23 11:31:57 +03:00
Fix multiple channels (#3474)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
b3a9498b71
commit
6100c73ae4
@ -77,7 +77,7 @@
|
||||
if (ev.detail.presenter !== undefined) {
|
||||
if (allowOpen) {
|
||||
closeTooltip()
|
||||
showPopup(ev.detail.presenter, { _id: attachedTo, _class: attachedClass }, 'float')
|
||||
showPopup(ev.detail.presenter, { channel: ev.detail.channel }, 'float')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,11 +31,7 @@
|
||||
|
||||
async function _open (ev: CustomEvent): Promise<void> {
|
||||
if (ev.detail.presenter !== undefined && Array.isArray(value)) {
|
||||
showPopup(
|
||||
ev.detail.presenter,
|
||||
{ _id: ev.detail.channel.attachedTo, _class: ev.detail.channel.attachedToClass },
|
||||
'float'
|
||||
)
|
||||
showPopup(ev.detail.presenter, { channel: ev.detail.channel }, 'float')
|
||||
}
|
||||
if (ev.detail.action !== undefined && Array.isArray(value)) {
|
||||
const action = await getResource(ev.detail.action as ViewAction)
|
||||
|
@ -15,26 +15,25 @@
|
||||
-->
|
||||
<script lang="ts">
|
||||
import contact, { Channel, Contact, getName } from '@hcengineering/contact'
|
||||
import { Class, getCurrentAccount, Ref } from '@hcengineering/core'
|
||||
import { employeeByIdStore } from '@hcengineering/contact-resources'
|
||||
import { getCurrentAccount } from '@hcengineering/core'
|
||||
import { Message, SharedMessage } from '@hcengineering/gmail'
|
||||
import { NotificationClientImpl } from '@hcengineering/notification-resources'
|
||||
import { getResource } from '@hcengineering/platform'
|
||||
import { createQuery } from '@hcengineering/presentation'
|
||||
import setting, { Integration } from '@hcengineering/setting'
|
||||
import templates, { TemplateDataProvider } from '@hcengineering/templates'
|
||||
import { Button, eventToHTMLElement, Icon, Label, Panel, showPopup } from '@hcengineering/ui'
|
||||
import { Button, Icon, Label, Panel, eventToHTMLElement, showPopup } from '@hcengineering/ui'
|
||||
import { createEventDispatcher, onDestroy } from 'svelte'
|
||||
import gmail from '../plugin'
|
||||
import { convertMessage } from '../utils'
|
||||
import Chats from './Chats.svelte'
|
||||
import Connect from './Connect.svelte'
|
||||
import FullMessage from './FullMessage.svelte'
|
||||
import IntegrationSelector from './IntegrationSelector.svelte'
|
||||
import NewMessage from './NewMessage.svelte'
|
||||
import { convertMessage } from '../utils'
|
||||
import { employeeByIdStore } from '@hcengineering/contact-resources'
|
||||
|
||||
export let _id: Ref<Contact>
|
||||
export let _class: Ref<Class<Contact>>
|
||||
export let channel: Channel
|
||||
export let embedded = false
|
||||
export let message: Message | undefined = undefined
|
||||
|
||||
@ -42,34 +41,18 @@
|
||||
let currentMessage: SharedMessage | undefined = undefined
|
||||
|
||||
let newMessage: boolean = false
|
||||
let channel: Channel | undefined = undefined
|
||||
const notificationClient = NotificationClientImpl.getClient()
|
||||
let integrations: Integration[] = []
|
||||
let selectedIntegration: Integration | undefined = undefined
|
||||
|
||||
const channelQuery = createQuery()
|
||||
notificationClient.forceRead(channel._id, channel._class)
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
$: channelQuery.query(
|
||||
contact.class.Channel,
|
||||
{
|
||||
attachedTo: _id,
|
||||
provider: contact.channelProvider.Email
|
||||
},
|
||||
(res) => {
|
||||
channel = res[0]
|
||||
if (channel !== undefined) {
|
||||
notificationClient.forceRead(channel._id, channel._class)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
const query = createQuery()
|
||||
$: _id &&
|
||||
_class &&
|
||||
query.query(_class, { _id }, (result) => {
|
||||
object = result[0]
|
||||
})
|
||||
$: query.query(channel.attachedToClass, { _id: channel.attachedTo }, (result) => {
|
||||
object = result[0] as Contact
|
||||
})
|
||||
|
||||
function back () {
|
||||
if (newMessage) {
|
||||
|
@ -24,7 +24,7 @@
|
||||
getName as getContactName
|
||||
} from '@hcengineering/contact'
|
||||
import { Avatar, employeeAccountByIdStore, employeeByIdStore } from '@hcengineering/contact-resources'
|
||||
import { Class, IdMap, Ref, SortingOrder, generateId, getCurrentAccount } from '@hcengineering/core'
|
||||
import { IdMap, Ref, SortingOrder, generateId, getCurrentAccount } from '@hcengineering/core'
|
||||
import { NotificationClientImpl } from '@hcengineering/notification-resources'
|
||||
import { getEmbeddedLabel, getResource } from '@hcengineering/platform'
|
||||
import { createQuery, getClient } from '@hcengineering/presentation'
|
||||
@ -49,30 +49,16 @@
|
||||
import Reconnect from './Reconnect.svelte'
|
||||
import TelegramIcon from './icons/Telegram.svelte'
|
||||
|
||||
export let _id: Ref<Contact>
|
||||
export let _class: Ref<Class<Contact>>
|
||||
export let channel: Channel
|
||||
export let embedded = false
|
||||
|
||||
let object: Contact
|
||||
let channel: Channel | undefined = undefined
|
||||
let objectId: Ref<NewTelegramMessage> = generateId()
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
const client = getClient()
|
||||
const notificationClient = NotificationClientImpl.getClient()
|
||||
const channelQuery = createQuery()
|
||||
|
||||
$: channelQuery.query(
|
||||
contact.class.Channel,
|
||||
{
|
||||
attachedTo: _id,
|
||||
provider: contact.channelProvider.Telegram
|
||||
},
|
||||
(res) => {
|
||||
channel = res[0]
|
||||
}
|
||||
)
|
||||
|
||||
let templateProvider: TemplateDataProvider | undefined
|
||||
|
||||
@ -88,11 +74,9 @@
|
||||
$: templateProvider && integration && templateProvider.set(setting.class.Integration, integration)
|
||||
|
||||
const query = createQuery()
|
||||
$: _id &&
|
||||
_class &&
|
||||
query.query(_class, { _id }, (result) => {
|
||||
object = result[0]
|
||||
})
|
||||
$: query.query(channel.attachedToClass, { _id: channel.attachedTo }, (result) => {
|
||||
object = result[0] as Contact
|
||||
})
|
||||
|
||||
let messages: TelegramMessage[] = []
|
||||
let integration: Integration | undefined
|
||||
|
Loading…
Reference in New Issue
Block a user