Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
}
5 changes: 4 additions & 1 deletion models/chunter/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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<SocialChannelProvider>
}

@Model(chunter.class.ThreadMessage, chunter.class.ChatMessage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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[] = []
Expand Down Expand Up @@ -187,6 +190,11 @@
<Icon icon={activity.icon.BookmarkFilled} size="xx-small" />
</div>
{/if}
{#if socialIcon}
<div class="socialIcon">
<Icon icon={socialIcon} size="x-small" />
</div>
{/if}
</div>
{/if}
<div class="flex-col ml-2 w-full clear-mins message-content">
Expand Down Expand Up @@ -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);
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.
-->
<script lang="ts">
import { Person, PersonAccount } from '@hcengineering/contact'
import contact, { Person, PersonAccount } from '@hcengineering/contact'
import { personAccountByIdStore, personByIdStore } from '@hcengineering/contact-resources'
import { Class, Doc, getCurrentAccount, Ref, Space, WithLookup } from '@hcengineering/core'
import { getClient, MessageViewer } from '@hcengineering/presentation'
Expand Down Expand Up @@ -142,6 +142,10 @@

let attachments: Attachment[] | undefined = undefined
$: attachments = value?.$lookup?.attachments as Attachment[] | undefined

$: socialProvider = value?.provider
? client.getModel().findAllSync(contact.class.ChannelProvider, { _id: value.provider })[0]
: undefined
</script>

{#if inline && object}
Expand Down Expand Up @@ -173,6 +177,7 @@
{skipLabel}
{pending}
{stale}
socialIcon={socialProvider?.icon}
showDatePreposition={hideLink}
{type}
{onClick}
Expand Down
3 changes: 2 additions & 1 deletion plugins/chunter/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -53,6 +53,7 @@ export interface ChatMessage extends ActivityMessage {
message: Markup
attachments?: number
editedOn?: Timestamp
provider?: Ref<SocialChannelProvider>
}

/**
Expand Down
6 changes: 4 additions & 2 deletions services/telegram-bot/pod-telegram-bot/src/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down