fix(hotfix): TelegramSection — gate GET /api/organization/telegram/status на advancedMode
Some checks are pending
Auto-tag / Create date-tag (push) Waiting to run
CI / Backend (.NET 8) (push) Waiting to run
CI / Web (React + Vite) (push) Waiting to run
CI / POS (WPF, Windows) (push) Waiting to run
Docker Web / Build + push Web (push) Waiting to run
Docker Web / Deploy Web on stage (push) Blocked by required conditions
Some checks are pending
Auto-tag / Create date-tag (push) Waiting to run
CI / Backend (.NET 8) (push) Waiting to run
CI / Web (React + Vite) (push) Waiting to run
CI / POS (WPF, Windows) (push) Waiting to run
Docker Web / Build + push Web (push) Waiting to run
Docker Web / Deploy Web on stage (push) Blocked by required conditions
Пропустил в первом коммите: OrganizationSettingsPage в простом режиме дёргал /api/organization/telegram/status, который [RequiresAdvancedMode]. Токсичный тост силен silent-GET-403 политикой (api.ts), но menu-walk e2e всё равно ловил 4 сетевых 403 для demo-admin → fail. Чиним у источника: не фетчим если not advanced. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
f434e87d9b
commit
f8480b06ae
|
|
@ -8,6 +8,7 @@ import { Field, TextInput, Select, Checkbox } from '@/components/Field'
|
||||||
import { FormSkeleton } from '@/components/Skeleton'
|
import { FormSkeleton } from '@/components/Skeleton'
|
||||||
import { useCountries } from '@/lib/useLookups'
|
import { useCountries } from '@/lib/useLookups'
|
||||||
import { useOrgSettings, type OrgSettings } from '@/lib/useOrgSettings'
|
import { useOrgSettings, type OrgSettings } from '@/lib/useOrgSettings'
|
||||||
|
import { useMe } from '@/lib/useMe'
|
||||||
|
|
||||||
interface DemoSeedSummary {
|
interface DemoSeedSummary {
|
||||||
alreadySeeded: boolean
|
alreadySeeded: boolean
|
||||||
|
|
@ -228,10 +229,16 @@ interface TelegramStatus {
|
||||||
*/
|
*/
|
||||||
function TelegramSection() {
|
function TelegramSection() {
|
||||||
const qc = useQueryClient()
|
const qc = useQueryClient()
|
||||||
|
// Hotfix: Telegram-binding — advanced-only (RequiresAdvancedMode).
|
||||||
|
// В простом режиме не фетчим — иначе 403 на reload настроек org.
|
||||||
|
const me = useMe()
|
||||||
|
const isAdvanced = !!me.data?.advancedMode || !!me.data?.roles?.includes('SuperAdmin')
|
||||||
const status = useQuery<TelegramStatus>({
|
const status = useQuery<TelegramStatus>({
|
||||||
queryKey: ['/api/organization/telegram/status'],
|
queryKey: ['/api/organization/telegram/status'],
|
||||||
queryFn: async () => (await api.get<TelegramStatus>('/api/organization/telegram/status')).data,
|
queryFn: async () => (await api.get<TelegramStatus>('/api/organization/telegram/status')).data,
|
||||||
|
enabled: isAdvanced,
|
||||||
})
|
})
|
||||||
|
if (!isAdvanced) return null
|
||||||
const [chatIdInput, setChatIdInput] = useState('')
|
const [chatIdInput, setChatIdInput] = useState('')
|
||||||
const bind = useMutation({
|
const bind = useMutation({
|
||||||
mutationFn: async () => {
|
mutationFn: async () => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue