mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-22 01:25:00 +02:00
Adjust tg bot (#8412)
* Remove notification provider func Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com> * Adjust tg-bot Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com> * Use global integration Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com> * Use workspace integration Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com> * getSocialIdBySocialKey -> findFullSocialIdBySocialKey Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com> * move findFullSocialIdBySocialKey to service operations Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com> * use listIntegrations with account token Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com> * Adjust api Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com> * Fxi tests Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com> --------- Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
@@ -46,9 +46,9 @@
|
||||
"ConnectAccount": "Připojit účet přes OTP",
|
||||
"ShowCommandsDetails": "Zobrazit detaily příkazů",
|
||||
"TurnNotificationsOff": "Vypnout oznámení",
|
||||
"ConnectedDescriptionHtml": "✅ Jste připojeni jako <b>{email}</b>",
|
||||
"AccountAlreadyConnectedHtml": "Již jste připojeni jako <b>{email}</b>",
|
||||
"AccountConnectedHtml": "Úspěšně jste se připojili jako <b>{email}</b>",
|
||||
"ConnectedDescriptionHtml": "✅ Jste připojeni jako <b>{name}</b>",
|
||||
"AccountAlreadyConnectedHtml": "Již jste připojeni jako <b>{name}</b>",
|
||||
"AccountConnectedHtml": "Úspěšně jste se připojili jako <b>{name}</b>",
|
||||
"AccountAlreadyConnected": "Účet je již připojen",
|
||||
"InvalidCode": "Neplatný kód",
|
||||
"SomethingWentWrong": "Něco se pokazilo. Zkuste to prosím znovu.",
|
||||
|
||||
@@ -46,9 +46,9 @@
|
||||
"ConnectAccount": "Konto über OTP verbinden",
|
||||
"ShowCommandsDetails": "Befehlsdetails anzeigen",
|
||||
"TurnNotificationsOff": "Benachrichtigungen ausschalten",
|
||||
"ConnectedDescriptionHtml": "✅Sie sind als <b>{email}</b> verbunden",
|
||||
"AccountAlreadyConnectedHtml": "Sie sind bereits als <b>{email}</b> verbunden",
|
||||
"AccountConnectedHtml": "Sie wurden erfolgreich als <b>{email}</b> verbunden",
|
||||
"ConnectedDescriptionHtml": "✅Sie sind als <b>{name}</b> verbunden",
|
||||
"AccountAlreadyConnectedHtml": "Sie sind bereits als <b>{name}</b> verbunden",
|
||||
"AccountConnectedHtml": "Sie wurden erfolgreich als <b>{name}</b> verbunden",
|
||||
"AccountAlreadyConnected": "Konto bereits verbunden",
|
||||
"InvalidCode": "Ungültiger Code",
|
||||
"SomethingWentWrong": "Etwas ist schiefgelaufen. Bitte versuchen Sie es erneut.",
|
||||
|
||||
@@ -46,9 +46,9 @@
|
||||
"ConnectAccount": "Connect account via OTP",
|
||||
"ShowCommandsDetails": "Show commands details",
|
||||
"TurnNotificationsOff": "Turn notifications off",
|
||||
"ConnectedDescriptionHtml": "✅Your are connected as <b>{email}</b>",
|
||||
"AccountAlreadyConnectedHtml": "You are already connected as <b>{email}</b>",
|
||||
"AccountConnectedHtml": "You have been successfully connected as <b>{email}</b>",
|
||||
"ConnectedDescriptionHtml": "✅Your are connected as <b>{name}</b>",
|
||||
"AccountAlreadyConnectedHtml": "You are already connected as <b>{name}</b>",
|
||||
"AccountConnectedHtml": "You have been successfully connected as <b>{name}</b>",
|
||||
"AccountAlreadyConnected": "Account already connected",
|
||||
"InvalidCode": "Invalid code",
|
||||
"SomethingWentWrong": "Something went wrong. Please try again.",
|
||||
|
||||
@@ -46,9 +46,9 @@
|
||||
"ConnectAccount": "Conectar cuenta a través de OTP",
|
||||
"ShowCommandsDetails": "Mostrar detalles de los comandos",
|
||||
"TurnNotificationsOff": "Desactivar notificaciones",
|
||||
"ConnectedDescriptionHtml": "✅Estás conectado como <b>{email}</b>",
|
||||
"AccountAlreadyConnectedHtml": "Ya estás conectado como <b>{email}</b>",
|
||||
"AccountConnectedHtml": "Te has conectado correctamente como <b>{email}</b>",
|
||||
"ConnectedDescriptionHtml": "✅Estás conectado como <b>{name}</b>",
|
||||
"AccountAlreadyConnectedHtml": "Ya estás conectado como <b>{name}</b>",
|
||||
"AccountConnectedHtml": "Te has conectado correctamente como <b>{name}</b>",
|
||||
"AccountAlreadyConnected": "Cuenta ya conectada",
|
||||
"InvalidCode": "Código no válido",
|
||||
"SomethingWentWrong": "Algo salió mal. Por favor, inténtalo de nuevo.",
|
||||
|
||||
@@ -46,9 +46,9 @@
|
||||
"ConnectAccount": "Connecter le compte via OTP",
|
||||
"ShowCommandsDetails": "Afficher les détails des commandes",
|
||||
"TurnNotificationsOff": "Désactiver les notifications",
|
||||
"ConnectedDescriptionHtml": "✅Vous êtes connecté en tant que <b>{email}</b>",
|
||||
"AccountAlreadyConnectedHtml": "Vous êtes déjà connecté en tant que <b>{email}</b>",
|
||||
"AccountConnectedHtml": "Vous avez été connecté avec succès en tant que <b>{email}</b>",
|
||||
"ConnectedDescriptionHtml": "✅Vous êtes connecté en tant que <b>{name}</b>",
|
||||
"AccountAlreadyConnectedHtml": "Vous êtes déjà connecté en tant que <b>{name}</b>",
|
||||
"AccountConnectedHtml": "Vous avez été connecté avec succès en tant que <b>{name}</b>",
|
||||
"AccountAlreadyConnected": "Compte déjà connecté",
|
||||
"InvalidCode": "Code invalide",
|
||||
"SomethingWentWrong": "Quelque chose s'est mal passé. Veuillez réessayer.",
|
||||
|
||||
@@ -46,9 +46,9 @@
|
||||
"ConnectAccount": "Collega l'account tramite OTP",
|
||||
"ShowCommandsDetails": "Mostra dettagli dei comandi",
|
||||
"TurnNotificationsOff": "Disattiva notifiche",
|
||||
"ConnectedDescriptionHtml": "✅Sei connesso come <b>{email}</b>",
|
||||
"AccountAlreadyConnectedHtml": "Sei già connesso come <b>{email}</b>",
|
||||
"AccountConnectedHtml": "Sei stato connesso con successo come <b>{email}</b>",
|
||||
"ConnectedDescriptionHtml": "✅Sei connesso come <b>{name}</b>",
|
||||
"AccountAlreadyConnectedHtml": "Sei già connesso come <b>{name}</b>",
|
||||
"AccountConnectedHtml": "Sei stato connesso con successo come <b>{name}</b>",
|
||||
"AccountAlreadyConnected": "Account già connesso",
|
||||
"InvalidCode": "Codice non valido",
|
||||
"SomethingWentWrong": "Qualcosa è andato storto. Per favore riprova.",
|
||||
|
||||
@@ -46,9 +46,9 @@
|
||||
"ConnectAccount": "Ligar conta via OTP",
|
||||
"ShowCommandsDetails": "Mostrar detalhes dos comandos",
|
||||
"TurnNotificationsOff": "Desativar notificações",
|
||||
"ConnectedDescriptionHtml": "✅Está ligado como <b>{email}</b>",
|
||||
"AccountAlreadyConnectedHtml": "Já está ligado como <b>{email}</b>",
|
||||
"AccountConnectedHtml": "Foi ligado com sucesso como <b>{email}</b>",
|
||||
"ConnectedDescriptionHtml": "✅Está ligado como <b>{name}</b>",
|
||||
"AccountAlreadyConnectedHtml": "Já está ligado como <b>{name}</b>",
|
||||
"AccountConnectedHtml": "Foi ligado com sucesso como <b>{name}</b>",
|
||||
"AccountAlreadyConnected": "Conta já ligada",
|
||||
"InvalidCode": "Código inválido",
|
||||
"SomethingWentWrong": "Algo correu mal. Por favor, tente novamente.",
|
||||
|
||||
@@ -46,9 +46,9 @@
|
||||
"ConnectAccount": "Подключить аккаунт через OTP",
|
||||
"ShowCommandsDetails": "Показать информацию о командах",
|
||||
"TurnNotificationsOff": "Отключить уведомления",
|
||||
"ConnectedDescriptionHtml": "✅Вы подключены как <b>${email}</b>",
|
||||
"AccountAlreadyConnectedHtml": "Вы уже подключены как <b>{email}</b>",
|
||||
"AccountConnectedHtml": "Вы успешно подключены как <b>{email}</b>",
|
||||
"ConnectedDescriptionHtml": "✅Вы подключены как <b>${name}</b>",
|
||||
"AccountAlreadyConnectedHtml": "Вы уже подключены как <b>{name}</b>",
|
||||
"AccountConnectedHtml": "Вы успешно подключены как <b>{name}</b>",
|
||||
"AccountAlreadyConnected": "Аккаунт уже подключен",
|
||||
"InvalidCode": "Неверный код",
|
||||
"SomethingWentWrong": "Что-то пошло не так. Пожалуйста, попробуйте снова.",
|
||||
|
||||
@@ -46,9 +46,9 @@
|
||||
"ConnectAccount": "通过 OTP 连接帐户",
|
||||
"ShowCommandsDetails": "显示命令详细信息",
|
||||
"TurnNotificationsOff": "关闭通知",
|
||||
"ConnectedDescriptionHtml": "✅您已连接为 <b>{email}</b>",
|
||||
"AccountAlreadyConnectedHtml": "您已连接为 <b>{email}</b>",
|
||||
"AccountConnectedHtml": "您已成功连接为 <b>{email}</b>",
|
||||
"ConnectedDescriptionHtml": "✅您已连接为 <b>{name}</b>",
|
||||
"AccountAlreadyConnectedHtml": "您已连接为 <b>{name}</b>",
|
||||
"AccountConnectedHtml": "您已成功连接为 <b>{name}</b>",
|
||||
"AccountAlreadyConnected": "帐户已连接",
|
||||
"InvalidCode": "无效代码",
|
||||
"SomethingWentWrong": "出现问题。 请重试。",
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
let isConnectionEstablished = false
|
||||
let connectionError: Error | undefined
|
||||
|
||||
let info: { name: string, username: string, photoUrl: string } | undefined = undefined
|
||||
let info: { name: string, username: string, photoId: string } | undefined = undefined
|
||||
let isLoading = false
|
||||
|
||||
const url = getMetadata(telegram.metadata.BotUrl) ?? ''
|
||||
@@ -134,8 +134,8 @@
|
||||
<div class="flex-col mt-2">
|
||||
<div class="title overflow-label mb-4">
|
||||
<div class="flex-row-center flex-gap-2">
|
||||
{#if info.photoUrl !== ''}
|
||||
<img class="photo" src={info.photoUrl} alt="" />
|
||||
{#if info.photoId !== ''}
|
||||
<img class="photo" src={concatLink(url, `/photo/${info.photoId}`)} alt="" />
|
||||
{:else}
|
||||
<Icon icon={TelegramColor} size="x-large" />
|
||||
{/if}
|
||||
|
||||
@@ -16,37 +16,14 @@
|
||||
<script lang="ts">
|
||||
import { ModernButton, showPopup } from '@hcengineering/ui'
|
||||
import telegram from '@hcengineering/telegram'
|
||||
import presentation from '@hcengineering/presentation'
|
||||
import { concatLink } from '@hcengineering/core'
|
||||
import { getMetadata } from '@hcengineering/platform'
|
||||
|
||||
import ConfigureBotPopup from './ConfigureBotPopup.svelte'
|
||||
|
||||
export let enabled: boolean
|
||||
|
||||
const url = getMetadata(telegram.metadata.BotUrl) ?? ''
|
||||
|
||||
function configureBot (): void {
|
||||
showPopup(ConfigureBotPopup, {})
|
||||
}
|
||||
|
||||
$: void updateWorkspace(enabled)
|
||||
|
||||
async function updateWorkspace (enabled: boolean): Promise<void> {
|
||||
if (url === '') return
|
||||
|
||||
try {
|
||||
const link = concatLink(url, '/updateWorkspace')
|
||||
await fetch(link, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Authorization: 'Bearer ' + getMetadata(presentation.metadata.Token),
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({ enabled })
|
||||
})
|
||||
} catch (e) {}
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if enabled}
|
||||
|
||||
@@ -13,10 +13,9 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import { ActivityMessage } from '@hcengineering/activity'
|
||||
import { ChannelItem } from '@hcengineering/contact'
|
||||
import { PersonId, AttachedDoc, Class, Doc, Ref, Timestamp } from '@hcengineering/core'
|
||||
import { InboxNotification, NotificationProvider, NotificationType } from '@hcengineering/notification'
|
||||
import { AttachedDoc, Class, Doc, Ref, Timestamp } from '@hcengineering/core'
|
||||
import { NotificationProvider, NotificationType } from '@hcengineering/notification'
|
||||
import type { IntlString, Metadata, Plugin } from '@hcengineering/platform'
|
||||
import { plugin } from '@hcengineering/platform'
|
||||
import type { Handler, IntegrationType } from '@hcengineering/setting'
|
||||
@@ -59,19 +58,6 @@ export interface SharedTelegramMessages extends AttachedDoc {
|
||||
messages: SharedTelegramMessage[]
|
||||
}
|
||||
|
||||
export interface TelegramNotificationRequest {
|
||||
notificationId: Ref<InboxNotification>
|
||||
messageId?: Ref<ActivityMessage>
|
||||
attachments: boolean
|
||||
workspace: string
|
||||
account: PersonId
|
||||
title: string
|
||||
quote?: string
|
||||
body: string
|
||||
sender: string
|
||||
link: string
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
|
||||
@@ -367,7 +367,7 @@ export async function connect (title: string): Promise<Client | undefined> {
|
||||
|
||||
Analytics.setUser(account)
|
||||
Analytics.setTag('workspace', wsUrl)
|
||||
console.log(`Logged in with account ${me.uuid} as ${me.role}`)
|
||||
console.log('Logged in with account: ', me)
|
||||
setCurrentAccount(me)
|
||||
setCurrentEmployee(employee)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user