mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-25 01:04:55 +03:00
Mark tg messages (#6333)
Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
parent
25b890940e
commit
7a18f73d12
19
.vscode/launch.json
vendored
19
.vscode/launch.json
vendored
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -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<SocialChannelProvider>
|
||||
}
|
||||
|
||||
@Model(chunter.class.ThreadMessage, chunter.class.ChatMessage)
|
||||
|
@ -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 @@
|
||||
<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">
|
||||
@ -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>
|
||||
|
@ -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'
|
||||
@ -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}
|
||||
@ -173,6 +177,7 @@
|
||||
{skipLabel}
|
||||
{pending}
|
||||
{stale}
|
||||
socialIcon={socialProvider?.icon}
|
||||
showDatePreposition={hideLink}
|
||||
{type}
|
||||
{onClick}
|
||||
|
@ -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<SocialChannelProvider>
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user