Skip to content

Commit e313a3f

Browse files
comfy-pr-botchristian-byrneclaude
authored
[backport cloud/1.47] fix: QA quick-wins — stale keybinding warning + 404 links (Contact/Terms/Privacy) (#13807)
Backport of #13777 to `cloud/1.47` Automatically created by backport workflow. Co-authored-by: Christian Byrne <cbyrne@comfy.org> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent c9c3ca8 commit e313a3f

4 files changed

Lines changed: 83 additions & 3 deletions

File tree

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
import { createTestingPinia } from '@pinia/testing'
2+
import { setActivePinia } from 'pinia'
3+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
4+
5+
import { KeybindingImpl } from '@/platform/keybindings/keybinding'
6+
import { useKeybindingService } from '@/platform/keybindings/keybindingService'
7+
import { useKeybindingStore } from '@/platform/keybindings/keybindingStore'
8+
import { useCommandStore } from '@/stores/commandStore'
9+
10+
const settings = vi.hoisted(() => ({
11+
values: {} as Record<string, unknown>
12+
}))
13+
14+
vi.mock('@/platform/settings/settingStore', () => ({
15+
useSettingStore: vi.fn(() => ({
16+
get: vi.fn((key: string) => settings.values[key] ?? [])
17+
}))
18+
}))
19+
20+
describe('keybindingService - registerUserKeybindings', () => {
21+
let warnSpy: ReturnType<typeof vi.spyOn>
22+
23+
beforeEach(() => {
24+
vi.clearAllMocks()
25+
settings.values = {}
26+
setActivePinia(createTestingPinia({ stubActions: false }))
27+
warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {})
28+
})
29+
30+
afterEach(() => {
31+
warnSpy.mockRestore()
32+
})
33+
34+
it('does not warn when unset binding targets a command that no longer exists', () => {
35+
// A command removed from the app (e.g. ConvertSelectedNodesToGroupNode,
36+
// removed in #12931) can still linger in the persisted UnsetBindings.
37+
settings.values['Comfy.Keybinding.UnsetBindings'] = [
38+
{
39+
commandId: 'ConvertSelectedNodesToGroupNode',
40+
combo: { key: 'g', ctrl: true, alt: false, shift: false }
41+
}
42+
]
43+
44+
useKeybindingService().registerUserKeybindings()
45+
46+
expect(warnSpy).not.toHaveBeenCalledWith(
47+
expect.stringContaining('Trying to unset non-exist keybinding')
48+
)
49+
})
50+
51+
it('still unsets bindings for commands that are registered', () => {
52+
const commandStore = useCommandStore()
53+
commandStore.registerCommand({
54+
id: 'Comfy.Test.Registered',
55+
function: vi.fn()
56+
})
57+
58+
const keybindingStore = useKeybindingStore()
59+
const combo = { key: 'g', ctrl: true, alt: false, shift: false }
60+
keybindingStore.addDefaultKeybinding(
61+
new KeybindingImpl({ commandId: 'Comfy.Test.Registered', combo })
62+
)
63+
64+
settings.values['Comfy.Keybinding.UnsetBindings'] = [
65+
{ commandId: 'Comfy.Test.Registered', combo }
66+
]
67+
68+
useKeybindingService().registerUserKeybindings()
69+
70+
expect(warnSpy).not.toHaveBeenCalledWith(
71+
expect.stringContaining('Trying to unset non-exist keybinding')
72+
)
73+
expect(
74+
keybindingStore.getKeybindingByCommandId('Comfy.Test.Registered')
75+
).toBeUndefined()
76+
})
77+
})

src/platform/keybindings/keybindingService.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ export function useKeybindingService() {
121121
function registerUserKeybindings() {
122122
const unsetBindings = settingStore.get('Comfy.Keybinding.UnsetBindings')
123123
for (const keybinding of unsetBindings) {
124+
if (!commandStore.isRegistered(keybinding.commandId)) {
125+
continue
126+
}
124127
keybindingStore.unsetKeybinding(new KeybindingImpl(keybinding))
125128
}
126129
const newBindings = settingStore.get('Comfy.Keybinding.NewBindings')

src/platform/workspace/components/PricingTableWorkspace.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ function handleSubscribe(tierKey: CheckoutTierKey) {
534534
}
535535
536536
function handleContactUs() {
537-
window.open('https://www.comfy.org/discord', '_blank')
537+
window.open('https://discord.com/invite/comfyorg', '_blank')
538538
}
539539
540540
function handleViewEnterprise() {

src/platform/workspace/components/SubscriptionTermsNote.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<i18n-t keypath="subscription.preview.termsAgreement" tag="span">
44
<template #terms>
55
<a
6-
href="https://www.comfy.org/terms"
6+
href="https://www.comfy.org/terms-of-service"
77
target="_blank"
88
rel="noopener noreferrer"
99
class="underline hover:text-base-foreground"
@@ -13,7 +13,7 @@
1313
</template>
1414
<template #privacy>
1515
<a
16-
href="https://www.comfy.org/privacy"
16+
href="https://www.comfy.org/privacy-policy"
1717
target="_blank"
1818
rel="noopener noreferrer"
1919
class="underline hover:text-base-foreground"

0 commit comments

Comments
 (0)