Skip to content

Commit

Permalink
allow free users to open tickets while viewing the billing page
Browse files Browse the repository at this point in the history
  • Loading branch information
MarconLP committed Apr 17, 2024
1 parent 7000050 commit 831971c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ export const SidePanelSupport = (): JSX.Element => {
</Section>
) : null}

{hasAvailableFeature(AvailableFeature.EMAIL_SUPPORT) ? (
{hasAvailableFeature(AvailableFeature.EMAIL_SUPPORT) ||
window.location.href.includes('/billing') ? (
<>
<Section title="Contact us">
<p>Can't find what you need in the docs?</p>
Expand Down Expand Up @@ -309,7 +310,10 @@ export const SidePanelSupport = (): JSX.Element => {
</ul>
</Section>

{!hasAvailableFeature(AvailableFeature.EMAIL_SUPPORT) ? (
{!(
hasAvailableFeature(AvailableFeature.EMAIL_SUPPORT) ||
window.location.href.includes('/billing')
) ? (
<Section title="Contact support">
<p>
Due to our large userbase, we're unable to offer email support to organizations
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/lib/components/Support/SupportForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import { useEffect, useRef } from 'react'
import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'
import { userLogic } from 'scenes/userLogic'

import { AvailableFeature } from '~/types'

import {
SEVERITY_LEVEL_TO_NAME,
SUPPORT_TICKET_TEMPLATES,
Expand Down Expand Up @@ -56,7 +58,7 @@ export function SupportForm(): JSX.Element | null {
const { setSendSupportRequestValue } = useActions(supportLogic)
const { objectStorageAvailable } = useValues(preflightLogic)
// the support model can be shown when logged out, file upload is not offered to anonymous users
const { user } = useValues(userLogic)
const { user, hasAvailableFeature } = useValues(userLogic)
// only allow authentication issues for logged out users

const dropRef = useRef<HTMLDivElement>(null)
Expand Down Expand Up @@ -129,6 +131,8 @@ export function SupportForm(): JSX.Element | null {
disabledReason={
!user
? 'Please login to your account before opening a ticket unrelated to authentication issues.'
: !hasAvailableFeature(AvailableFeature.EMAIL_SUPPORT)
? 'You can only create billing related issues while viewing the billing page.'
: null
}
fullWidth
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lib/components/Support/supportLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,8 @@ export const supportLogic = kea<supportLogicType>([
let area = target_area ?? getURLPathToTargetArea(window.location.pathname)
if (!userLogic.values.user) {
area = 'login'
} else if (window.location.href.includes('/billing')) {
area = 'billing'
}
kind = kind ?? 'support'
actions.resetSendSupportRequest({
Expand Down

0 comments on commit 831971c

Please sign in to comment.