mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-21 09:07:50 +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:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user