mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-23 22:25:05 +00:00
*PR Created by the Glary-Bot Agent* --- ## Summary PR #10890 routed the legacy action bar feedback button and the Help Center feedback item to the nightly Typeform survey, but the **default topbar feedback button** in `WorkflowTabs.vue` still called `buildFeedbackUrl()` and opened Zendesk. Since `Comfy.UI.TabBarLayout` defaults to `Default` (not `Legacy`), most Cloud/Nightly users were clicking the WorkflowTabs button and never reaching the Typeform survey — explaining the lack of survey responses. ## Changes - Added a shared `buildFeedbackTypeformUrl(source)` helper in `platform/support/config.ts` that tags the survey URL with: - `distribution`: `ccloud` / `oss-nightly` / `oss` (preserves the build-tagging the old `buildFeedbackUrl()` sent to Zendesk so responses stay segmented) - `source`: `topbar` / `action-bar` / `help-center` (identifies which UI entry point launched the survey) Tags are passed via the URL fragment (Typeform's hidden-field convention), so they reach the survey but are never sent to the server in the request line. - `WorkflowTabs.vue`: replaced `buildFeedbackUrl()` with `buildFeedbackTypeformUrl('topbar')`. - `cloudFeedbackTopbarButton.ts` and `HelpCenterMenuContent.vue`: use the shared builder with their respective source labels instead of inline URL literals. - Removed the now-unused `buildFeedbackUrl()` and `ZENDESK_FEEDBACK_FORM_ID` (knip-clean). `buildSupportUrl()` is preserved — `Comfy.ContactSupport` (the Help Center "Help" item) still routes to Zendesk as before. - Added unit tests for the builder, the WorkflowTabs feedback button, the legacy action bar button, and the Help Center feedback item (covering both the Cloud/Nightly Typeform path and the OSS `Comfy.ContactSupport` fallback). ## Verification - `pnpm format`, `pnpm lint`, `pnpm typecheck`, `pnpm knip`: clean (one pre-existing unrelated lint warning in `useWorkspaceBilling.test.ts`) - `pnpm test:unit` (impacted scope): 506/506 passing, including 13 new tests ## Review Focus - Cloud/Nightly gating in `WorkflowTabs.vue` (`v-if="isCloud || isNightly"`) is unchanged and matches PR #10890's gating philosophy. - The Help Center "Help" item and `Comfy.ContactSupport` command intentionally still route to Zendesk — feedback ≠ support. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-11863-fix-route-default-topbar-feedback-button-to-Typeform-3556d73d3650815fb446dac33095d4be) by [Unito](https://www.unito.io) --------- Co-authored-by: Glary-Bot <glary-bot@users.noreply.github.com>
84 lines
2.3 KiB
TypeScript
84 lines
2.3 KiB
TypeScript
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
|
|
|
import type { ActionBarButton } from '@/types/comfy'
|
|
|
|
const distribution = vi.hoisted(() => ({ isCloud: false, isNightly: false }))
|
|
|
|
const tabBarLayout = vi.hoisted(() => ({ value: 'Default' }))
|
|
const registerExtension = vi.hoisted(() => vi.fn())
|
|
|
|
vi.mock('@/i18n', () => ({
|
|
t: (key: string) => key
|
|
}))
|
|
|
|
vi.mock('@/platform/settings/settingStore', () => ({
|
|
useSettingStore: () => ({
|
|
get: (key: string) =>
|
|
key === 'Comfy.UI.TabBarLayout' ? tabBarLayout.value : undefined
|
|
})
|
|
}))
|
|
|
|
vi.mock('@/services/extensionService', () => ({
|
|
useExtensionService: () => ({
|
|
registerExtension
|
|
})
|
|
}))
|
|
|
|
vi.mock('@/platform/distribution/types', () => ({
|
|
get isCloud() {
|
|
return distribution.isCloud
|
|
},
|
|
get isNightly() {
|
|
return distribution.isNightly
|
|
}
|
|
}))
|
|
|
|
describe('cloudFeedbackTopbarButton', () => {
|
|
let openSpy: ReturnType<typeof vi.spyOn>
|
|
|
|
beforeEach(() => {
|
|
vi.resetModules()
|
|
registerExtension.mockReset()
|
|
distribution.isCloud = false
|
|
distribution.isNightly = false
|
|
openSpy = vi.spyOn(window, 'open').mockReturnValue(null)
|
|
})
|
|
|
|
afterEach(() => {
|
|
openSpy.mockRestore()
|
|
})
|
|
|
|
function getRegisteredButtons(): ActionBarButton[] {
|
|
expect(registerExtension).toHaveBeenCalledTimes(1)
|
|
const extension = registerExtension.mock.calls[0]?.[0] as {
|
|
actionBarButtons: ActionBarButton[]
|
|
}
|
|
return extension.actionBarButtons
|
|
}
|
|
|
|
it('opens the Typeform survey tagged with action-bar source on Cloud', async () => {
|
|
tabBarLayout.value = 'Legacy'
|
|
distribution.isCloud = true
|
|
await import('./cloudFeedbackTopbarButton')
|
|
|
|
const buttons = getRegisteredButtons()
|
|
expect(buttons).toHaveLength(1)
|
|
buttons[0].onClick?.()
|
|
|
|
expect(openSpy).toHaveBeenCalledTimes(1)
|
|
const [url, target, features] = openSpy.mock.calls[0]
|
|
expect(url).toBe(
|
|
'https://form.typeform.com/to/q7azbWPi#distribution=ccloud&source=action-bar'
|
|
)
|
|
expect(target).toBe('_blank')
|
|
expect(features).toBe('noopener,noreferrer')
|
|
})
|
|
|
|
it('only registers the action bar button when the tab bar is Legacy', async () => {
|
|
tabBarLayout.value = 'Default'
|
|
await import('./cloudFeedbackTopbarButton')
|
|
|
|
expect(getRegisteredButtons()).toEqual([])
|
|
})
|
|
})
|