diff --git a/.vscode/launch.json b/.vscode/launch.json index 1d7fade17a..3d03e76d00 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -415,6 +415,25 @@ "cwd": "${workspaceRoot}/services/ai-bot/pod-ai-bot", "protocol": "inspector", "outputCapture": "std" + }, + { + "name": "Debug telegram bot", + "type": "node", + "request": "launch", + "args": ["src/index.ts"], + "env": { + "PORT": "4020", + "BOT_TOKEN": "token", + "MONGO_URL": "mongodb://localhost:27017", + "MONGO_DB": "telegram-bot", + "SECRET": "secret", + "ACCOUNTS_URL": "http://localhost:3000", + "SERVICE_ID": "telegram-bot-service" + }, + "runtimeArgs": ["--nolazy", "-r", "ts-node/register"], + "runtimeVersion": "20", + "sourceMaps": true, + "cwd": "${workspaceRoot}/services/telegram-bot/pod-telegram-bot" } ] } diff --git a/models/chunter/src/index.ts b/models/chunter/src/index.ts index dfd25f4c10..67ac89d509 100644 --- a/models/chunter/src/index.ts +++ b/models/chunter/src/index.ts @@ -27,7 +27,7 @@ import { type ChannelInfo } from '@hcengineering/chunter' import presentation from '@hcengineering/model-presentation' -import contact, { type Person } from '@hcengineering/contact' +import contact, { type ChannelProvider as SocialChannelProvider, type Person } from '@hcengineering/contact' import { type Class, type Doc, @@ -98,6 +98,9 @@ export class TChatMessage extends TActivityMessage implements ChatMessage { shortLabel: attachment.string.Files }) attachments?: number + + @Prop(TypeRef(contact.class.ChannelProvider), core.string.Object) + provider?: Ref } @Model(chunter.class.ThreadMessage, chunter.class.ChatMessage) diff --git a/plugins/activity-resources/src/components/activity-message/ActivityMessageTemplate.svelte b/plugins/activity-resources/src/components/activity-message/ActivityMessageTemplate.svelte index b952d42c7c..d2586b7c3d 100644 --- a/plugins/activity-resources/src/components/activity-message/ActivityMessageTemplate.svelte +++ b/plugins/activity-resources/src/components/activity-message/ActivityMessageTemplate.svelte @@ -24,6 +24,7 @@ import { getClient } from '@hcengineering/presentation' import { Action, Icon, Label } from '@hcengineering/ui' import { getActions, restrictionStore, showMenu } from '@hcengineering/view-resources' + import { Asset } from '@hcengineering/platform' import ReactionsPresenter from '../reactions/ReactionsPresenter.svelte' import ActivityMessagePresenter from './ActivityMessagePresenter.svelte' @@ -56,6 +57,8 @@ export let type: ActivityMessageViewType = 'default' export let onClick: (() => void) | undefined = undefined + export let socialIcon: Asset | undefined = undefined + const client = getClient() let menuActionIds: string[] = [] @@ -187,6 +190,11 @@ {/if} + {#if socialIcon} + + {/if} {/if}
@@ -391,4 +399,20 @@ flex-shrink: 1; padding: 0; } + + .socialIcon { + position: absolute; + display: flex; + align-items: center; + justify-content: center; + width: 1.25rem; + height: 1.25rem; + padding: var(--spacing-1); + border-radius: 50%; + background: var(--theme-bg-color); + border: 1px solid var(--global-ui-BorderColor); + bottom: -0.375rem; + right: -0.375rem; + color: var(--content-color); + } diff --git a/plugins/chunter-resources/src/components/chat-message/ChatMessagePresenter.svelte b/plugins/chunter-resources/src/components/chat-message/ChatMessagePresenter.svelte index 1905c71fb6..565c8ac628 100644 --- a/plugins/chunter-resources/src/components/chat-message/ChatMessagePresenter.svelte +++ b/plugins/chunter-resources/src/components/chat-message/ChatMessagePresenter.svelte @@ -13,7 +13,7 @@ // limitations under the License. --> {#if inline && object} @@ -173,6 +177,7 @@ {skipLabel} {pending} {stale} + socialIcon={socialProvider?.icon} showDatePreposition={hideLink} {type} {onClick} diff --git a/plugins/chunter/src/index.ts b/plugins/chunter/src/index.ts index ba8f80c01c..93137eec92 100644 --- a/plugins/chunter/src/index.ts +++ b/plugins/chunter/src/index.ts @@ -20,7 +20,7 @@ import type { Asset, Plugin } from '@hcengineering/platform' import { IntlString, plugin } from '@hcengineering/platform' import { AnyComponent } from '@hcengineering/ui' import { Action } from '@hcengineering/view' -import { Person } from '@hcengineering/contact' +import { Person, ChannelProvider as SocialChannelProvider } from '@hcengineering/contact' /** * @public @@ -53,6 +53,7 @@ export interface ChatMessage extends ActivityMessage { message: Markup attachments?: number editedOn?: Timestamp + provider?: Ref } /** diff --git a/services/telegram-bot/pod-telegram-bot/src/workspace.ts b/services/telegram-bot/pod-telegram-bot/src/workspace.ts index 1d02ec4e04..fbeaac4379 100644 --- a/services/telegram-bot/pod-telegram-bot/src/workspace.ts +++ b/services/telegram-bot/pod-telegram-bot/src/workspace.ts @@ -55,7 +55,8 @@ export class WorkspaceClient { objectClass: thread.objectClass, message: text, attachments: 0, - collection: 'replies' + collection: 'replies', + provider: contact.channelProvider.Telegram }) ) await this.client.tx(collectionTx) @@ -72,7 +73,8 @@ export class WorkspaceClient { objectClass: message.attachedToClass, message: text, attachments: 0, - collection: 'replies' + collection: 'replies', + provider: contact.channelProvider.Telegram }) ) await this.client.tx(collectionTx)