Skip to content

Commit 0184771

Browse files
comfy-pr-botmarawan206DrJKLchristian-byrne
authored
[backport core/1.30] feat: pre-fill user info in Zendesk support link (#6737)
Backport of #6586 to `core/1.30` Automatically created by backport workflow. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6737-backport-core-1-30-feat-pre-fill-user-info-in-Zendesk-support-link-2af6d73d36508194a374d834c37ee32b) by [Unito](https://www.unito.io) Co-authored-by: Marwan Ahmed <[email protected]> Co-authored-by: Alexander Brown <[email protected]> Co-authored-by: bymyself <[email protected]>
1 parent 30d4b8f commit 0184771

File tree

2 files changed

+43
-11
lines changed

2 files changed

+43
-11
lines changed

src/composables/useCoreCommands.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useCurrentUser } from '@/composables/auth/useCurrentUser'
12
import { useFirebaseAuthActions } from '@/composables/auth/useFirebaseAuthActions'
23
import { useSelectedLiteGraphItems } from '@/composables/canvas/useSelectedLiteGraphItems'
34
import { useModelSelectorDialog } from '@/composables/useModelSelectorDialog'
@@ -23,7 +24,7 @@ import { useAssetBrowserDialog } from '@/platform/assets/composables/useAssetBro
2324
import { createModelNodeFromAsset } from '@/platform/assets/utils/createModelNodeFromAsset'
2425
import { isCloud } from '@/platform/distribution/types'
2526
import { useSettingStore } from '@/platform/settings/settingStore'
26-
import { SUPPORT_URL } from '@/platform/support/config'
27+
import { buildSupportUrl } from '@/platform/support/config'
2728
import { useTelemetry } from '@/platform/telemetry'
2829
import { useToastStore } from '@/platform/updates/common/toastStore'
2930
import { useWorkflowService } from '@/platform/workflow/core/services/workflowService'
@@ -785,7 +786,12 @@ export function useCoreCommands(): ComfyCommand[] {
785786
label: 'Contact Support',
786787
versionAdded: '1.17.8',
787788
function: () => {
788-
window.open(SUPPORT_URL, '_blank')
789+
const { userEmail, resolvedUserInfo } = useCurrentUser()
790+
const supportUrl = buildSupportUrl({
791+
userEmail: userEmail.value,
792+
userId: resolvedUserInfo.value?.id
793+
})
794+
window.open(supportUrl, '_blank')
789795
}
790796
},
791797
{

src/platform/support/config.ts

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,43 @@
11
import { isCloud } from '@/platform/distribution/types'
22

33
/**
4-
* Zendesk ticket form field ID for the distribution tag.
5-
* This field is used to categorize support requests by their source (cloud vs OSS).
4+
* Zendesk ticket form field IDs.
65
*/
7-
const DISTRIBUTION_FIELD_ID = 'tf_42243568391700'
6+
const ZENDESK_FIELDS = {
7+
/** Distribution tag (cloud vs OSS) */
8+
DISTRIBUTION: 'tf_42243568391700',
9+
/** User email (anonymous requester) */
10+
ANONYMOUS_EMAIL: 'tf_anonymous_requester_email',
11+
/** User email (authenticated) */
12+
EMAIL: 'tf_40029135130388',
13+
/** User ID */
14+
USER_ID: 'tf_42515251051412'
15+
} as const
16+
17+
const SUPPORT_BASE_URL = 'https://support.comfy.org/hc/en-us/requests/new'
818

919
/**
10-
* Support URLs for the ComfyUI platform.
11-
* The URL varies based on whether the application is running in Cloud or OSS distribution.
20+
* Builds the support URL with optional user information for pre-filling.
21+
* Users without login information will still get a valid support URL without pre-fill.
1222
*
13-
* - Cloud: Includes 'ccloud' tag for identifying cloud-based support requests
14-
* - OSS: Includes 'oss' tag for identifying open-source support requests
23+
* @param params - User information to pre-fill in the support form
24+
* @returns Complete Zendesk support URL with query parameters
1525
*/
16-
const TAG = isCloud ? 'ccloud' : 'oss'
17-
export const SUPPORT_URL = `https://support.comfy.org/hc/en-us/requests/new?${DISTRIBUTION_FIELD_ID}=${TAG}`
26+
export function buildSupportUrl(params?: {
27+
userEmail?: string | null
28+
userId?: string | null
29+
}): string {
30+
const searchParams = new URLSearchParams({
31+
[ZENDESK_FIELDS.DISTRIBUTION]: isCloud ? 'ccloud' : 'oss'
32+
})
33+
34+
if (params?.userEmail) {
35+
searchParams.append(ZENDESK_FIELDS.ANONYMOUS_EMAIL, params.userEmail)
36+
searchParams.append(ZENDESK_FIELDS.EMAIL, params.userEmail)
37+
}
38+
if (params?.userId) {
39+
searchParams.append(ZENDESK_FIELDS.USER_ID, params.userId)
40+
}
41+
42+
return `${SUPPORT_BASE_URL}?${searchParams.toString()}`
43+
}

0 commit comments

Comments
 (0)